1
使用某些电子邮件客户端(Evolution,Thunderbird)可以正常查看电子邮件,但对于其他客户端(例如GMX),邮件正文保持空白,消息的正文被发送。在某些电子邮件客户端显示为附件的纯文本电子邮件
我想知道我是如何防止这种情况发生的,因为这条消息是为了让人类阅读而让附件中的身体很奇怪。
my $ServerName = "";
my $from_address = '';
my $to_address = '';
my $subject = 'MIME Test: Text';
my $mime_type = 'text';
my $message_body = "This is a test.\n";
# Create the initial text of the message
my $mime_msg = MIME::Lite->new(
From => $from_address,
To => $to_address,
Subject => $subject,
Type => $mime_type,
Data => encode("utf8",$message_body)
) or die "Error creating MIME body: $!\n";
# encode body of message as a string so that we can pass it to Net::SMTP.
$message_body = $mime_msg->body_as_string();
# Let MIME::Lite handle the Net::SMTP details
MIME::Lite->send('smtp', $ServerName,);# AuthUser => $user, AuthPass => $pass);
$mime_msg->send() or die "Error sending message: $!\n";
我使用电子邮件发件人::现在一切工作正常。 –