我一直在升级一些Perl sendmail自动电子邮件,以利用Email :: MIME :: CreateHTML和Email :: Sender的功能,特别是SMTP身份验证。它工作正常。
use Email::Sender::Simple qw(sendmail);
use Email::Sender::Transport::SMTP ();
use Email::MIME::CreateHTML;
my $smtpserver = 'myserver.com';
my $smtpport = ###;
my $smtpuser = 'noreply@mywebsite.com';
my $smtppassword = 'mypassword';
my $xport = Email::Sender::Transport::SMTP->new({
host => $smtpserver,
port => $smtpport,
ssl => 'ssl',
sasl_username => $smtpuser,
sasl_password => $smtppassword,
});
my $email = Email::MIME->create_html(
header => [
To => $email_to_recipient,
From => $email_from_person,
Subject => $email_subject_line,
],
body => $email_body_code,
);
sendmail($email, { transport => $transport });
但是,我无法在文档中的任何位置找到如何添加“回复”选项。使用sendmail就像添加另一行一样简单:
print SENDMAIL "From: noreply\@myserver.com\n";
print SENDMAIL "To: recipient@theirserver.com";
print SENDMAIL "Reply-to: replyhere@myserver.com\n";
试图潜入:
my $email = Email::MIME->create_html(
header => [
To => $email_to_recipient,
From => $email_from_person,
Reply-to => $email_reply_to_person,
Subject => $email_subject_line,
],
body => $email_body_code,
);
sendmail($email, { transport => $transport });
但是回复部分被忽略了。任何帮助将不胜感激。