简体   繁体   English

如何使用Perl的sendmail在“发件人”字段中使用特殊字符(星号)

[英]How is it possible to use a special character (a star) in the “from” field using Perl's sendmail

I am using Perl's SENDMAIL to receive email from my website: 我正在使用Perl的SENDMAIL从我的网站接收电子邮件:

open(SENDMAIL, "|$sendmail") or die "Cannot open $sendmail: $!";
    print SENDMAIL "From: $from\n";
    print SENDMAIL "Subject: $subject\n";
    print SENDMAIL "To: $to\n";
    print SENDMAIL "Content-type: text/plain\n\n";
    print SENDMAIL $message;
close(SENDMAIL);

And I would like to modify the $from variable to be something like this: 我想将$ from变量修改为如下形式:

$from = "&#x2605; David Jones <david.jones@oozicle.com>"

What happens right now is that I just see the ampersand etc., and the star is not shown. 现在发生的是,我只看到&符号等,而没有显示星星。

I know that it is possible to use special characters because I receive spam containing them. 我知道可以使用特殊字符,因为我收到包含特殊字符的垃圾邮件。

Is it possible to do this using SENDMAIL? 是否可以使用SENDMAIL做到这一点?

use Encode qw( encode );

my $name = "\x{2605} David Jones";
my $addr = 'david.jones@oozicle.com';

my $from_header = encode('MIME-Header', $name) . ' <' . $addr . '>';

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM