这可能是一个对SO和SF都有效的交叉问题。 我使用如下的Perl脚本发送电子邮件:
my $SMTP_SERVER = 'xx.xx.xx.xx';
my $DEFAULT_SENDER = 'yyy@xxx.com';
my $DEFAULT_RECIPIENT = 'yyy@xxx.com';
### Create the multipart "container":
$msg = MIME::Lite->new(
From =>$DEFAULT_SENDER,
To =>$input{to},
Cc =>$DEFAULT_SENDER,
Subject =>$input{mailsubject},
Type =>'multipart/mixed'
);
my $msgbody="<body bgcolor=\"#C0C0C0\">\n";
$msgbody.="<img src="cid:xyz.gif"><br>O hai thar.."
$msgbody.="</body>";
### Add the text message part:
### (Note that "attach" has same arguments as "new"):
$msg->attach(
Type =>'text/html',
Data =>$msgbody
);
### Add the logo image part:
$msg->attach(
Type => 'image/gif',
Id => 'xyz.gif',
Path => '/var/www/images/xyz.gif',
);
### Add the file part:
$msg->attach(
Type =>'application/zip',
Path =>$input{fullpath},
Filename =>$input{file},
Disposition => 'attachment'
);
open ERROR, '>>', "/debug/error.txt" or die $!;
STDERR->fdopen( \*ERROR, 'w' );
eval{
# send the email
MIME::Lite->send('smtp', $SMTP_SERVER, Timeout=>30, Debug=>1, Notify => ['FAILURE','DELAY'], SkipBad => 1 );
$msg->send();
1;
}
or do{&error($@)};
close ERROR;
现在这个脚本对98%发送的电子邮件很有用..然而..大2%的客户端是我现在想要解决的问题。每当我特别发送给这个客户端时,我收到消息: SMTP data()命令失败:2.1.5 ...收件人确定。
之前有没有人看过这个错误,或者对我的问题在哪里有任何疑问?我尝试更换X-Mailer:标题,认为是垃圾邮件过滤。我尝试向我们域中的其他人发送相同的消息,但这不会对此客户端URL有效。
下面的示例标题:
MIME-Version: 1.0
Content-Transfer-Encoding: binary
Content-Type: multipart/mixed;
boundary="_----------=_12845827796770"
X-Mailer: MIME::Lite 3.027 (F2.76; T1.29; A2.03; B3.07_01; Q3.07)
Date: Wed, 15 Sep 2010 13:37:59 -0700
From: yyy@xxx.com
To: client1@clienturl.com, client2@clienturl.com, me@xxx.com
Cc: yyy@xxx.com
Subject: TEST
任何线索?
此外,使用具有相同附件的Outlook直接发送电子邮件与此客户端和相同的smtp服务器完美配合。只有当通过这个自动化过程发送时,错误才会让人头疼。
更新 调试日志(我认为这是一个很大的延迟问题,其中响应异步并且在MIME :: Lite的过程中恢复正常的操作流程)
MIME::Lite::SMTP>>> MIME::Lite::SMTP
MIME::Lite::SMTP>>> Net::SMTP(2.31)
MIME::Lite::SMTP>>> Net::Cmd(2.29)
MIME::Lite::SMTP>>> Exporter(5.62)
MIME::Lite::SMTP>>> IO::Socket::INET(1.31)
MIME::Lite::SMTP>>> IO::Socket(1.30_01)
MIME::Lite::SMTP>>> IO::Handle(1.27)
MIME::Lite::SMTP=GLOB(0x84ac258)<<< 220 smpt.xxx.com ESMTP Sendmail 8.12.9/8.13.1; Wed, 15 Sep 2010 16:50:44 -0700 (PDT)
MIME::Lite::SMTP=GLOB(0x84ac258)>>> EHLO localhost.localdomain
MIME::Lite::SMTP=GLOB(0x84ac258)<<< 250-smpt.xxx.com Hello [xx.xx.xx.xx], pleased to meet you
MIME::Lite::SMTP=GLOB(0x84ac258)<<< 250-ENHANCEDSTATUSCODES
MIME::Lite::SMTP=GLOB(0x84ac258)<<< 250-PIPELINING
MIME::Lite::SMTP=GLOB(0x84ac258)<<< 250-8BITMIME
MIME::Lite::SMTP=GLOB(0x84ac258)<<< 250-SIZE
MIME::Lite::SMTP=GLOB(0x84ac258)<<< 250-DSN
MIME::Lite::SMTP=GLOB(0x84ac258)<<< 250-ETRN
MIME::Lite::SMTP=GLOB(0x84ac258)<<< 250-DELIVERBY
MIME::Lite::SMTP=GLOB(0x84ac258)<<< 250 HELP
MIME::Lite::SMTP=GLOB(0x84ac258)>>> MAIL FROM:<yyy@xxx.com>
MIME::Lite::SMTP=GLOB(0x84ac258)<<< 250 2.1.0 <yyy@xxx.com>... Sender ok
MIME::Lite::SMTP=GLOB(0x84ac258)>>> RCPT TO:<client1@clienturl.com>
[Wed Sep 15 16:41:22 2010] myemailscript.cgi: MIME::Lite::SMTP=GLOB(0x84ac258): Timeout at /usr/local/share/perl/5.10.0/MIME/Lite.pm line 2889
MIME::Lite::SMTP=GLOB(0x84ac258)>>> RCPT TO:<client2@clienturl.com>
[Wed Sep 15 16:41:52 2010] myemailscript.cgi: MIME::Lite::SMTP=GLOB(0x84ac258): Timeout at /usr/local/share/perl/5.10.0/MIME/Lite.pm line 2889
MIME::Lite::SMTP=GLOB(0x84ac258)>>> RCPT TO:<me@xxx.com>
[Wed Sep 15 16:42:22 2010] myemailscript.cgi: MIME::Lite::SMTP=GLOB(0x84ac258): Timeout at /usr/local/share/perl/5.10.0/MIME/Lite.pm line 2889
MIME::Lite::SMTP=GLOB(0x84ac258)>>> RCPT TO:<yyy@xxx.com>
MIME::Lite::SMTP=GLOB(0x84ac258)<<< 250 2.1.5 <client1@clienturl.com>... Recipient ok
MIME::Lite::SMTP=GLOB(0x84ac258)>>> DATA
MIME::Lite::SMTP=GLOB(0x84ac258)<<< 250 2.1.5 <client2@clienturl.com>... Recipient ok
答案 0 :(得分:3)
Net :: SMTP客户端似乎超时,但RCTP TO的响应最终会在不再需要时到达。尝试将超时设置为300秒而不是30?