我正在按照这个网站上的示例使用 Perl 发送电子邮件。代码如下所示:
my $hostname = `hostname`;
my $this_day = `date`;
my $email = "i.h4d35\@gmail.com";
my $to = "$email";
my $from = "admin\@$hostname";
my $subject = "SCHEDULE COMPLETE - $this_day";
my $message = "Student schedule for today, completed for the following students: \n\n$names\n\nHave a nice day...";
open(MAIL, "|/usr/sbin/sendmail -t");
print MAIL "To: $to\n";
print MAIL "From: $from\n";
print MAIL "Subject: $subject\n\n";
print MAIL $message;
close(MAIL);
邮件已发送,但主题出现在邮件正文中,并且电子邮件没有主题。我该如何解决?
PS:还没有开始使用MIME::Lite
,因为我还在学习这个。