使用Perl发送邮件时如何显示发件人邮件的名称?

时间:2015-01-02 12:44:22

标签: perl email

我使用Perl中的以下代码发送邮件

#!/usr/bin/perl
$to = 'abcd@gmail.com';
$from = 'webmaster@yourdomain.com'; 
$subject = 'Test Email'; 
$message = 'This is test email sent by Perl Script'; 
open(MAIL, "|/usr/sbin/sendmail -t"); 
# Email Header 
print MAIL "To: $to\n"; 
print MAIL "From: $from\n"; 
print MAIL "Subject: $subject\n\n"; 

# Email Body 
print MAIL $message; 
close(MAIL); 
print "Email Sent Successfully\n";

现在,当我看到名字时,如何获取发件人的姓名。例如。当我保留$ abcd@xyz.com时,它显示名称为abc,而我想给它命名为James Lawson。?

0 个答案:

没有答案