0

我正在使用 Mail::Sender ,我收到错误消息

未建立连接。

我正在使用 OpenMultipart 来填充哈希。

这个错误什么时候会出现?如何解决这个问题?

如果我发送 10 封邮件,只有 2 封邮件成功发送,其余邮件收到此错误。

$Msg = new Mail::Sender (
                {
                smtp => $EMAIL_Globals::SMTP_IP,
                from => $FromAddress,
                debug_level => 4,
                }
                );

eval {
        $Msg->OpenMultipart({
                        from => ${$Email_details}[10],
                        to =>  ${$Email_details}[9],
                        subject => $Subject,
                        debug => '/tmp/zkMailFlow.log',
                        multipart => 'related',
                        })
        ->Part({ctype => 'multipart/alternative'})
                ->Part({ctype => 'text/html', disposition => 'NONE', msg => " 
                                <!DOCTYPE html PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN>
                                <html> xxxxx
                                </html>" })
                ->EndPart("multipart/alternative");
        for ( ;$i<= $Length; $i+=4) {
                $Count=$i;
                $Flag = 1;
                $Msg->Attach({
                                description => 'xxxxx',
                                ctype => 'image/jpeg',
                                encoding => 'base64',
                                disposition => "attachment; filename=$Page_id[$i];",
                                file => '/path/files/i',
                                });
        }
        $Msg->Close();
} or print "Error sending mail: $Mail::Sender::Error\n";

if ($Mail::Sender::Error)
{
        if ($Msg->{"error"} eq -3)
        {
                return('FAILURE',$Mail::Sender::Error);
        }
        else
        {
                return('Error',$Mail::Sender::Error);
        }
}

if ( ref ($Msg) ne 'Mail::Sender' ){
        return ('Error',$Mail::Sender::Error);
}
else{
        return('SUCCESS',"Mail Sent Successfully");
}

调试日志文件内容

>> 220 nsmtpin.xxxxb.co.in ESMTP Service (Lotus Domino Release 8.5.2) ready at Wed, 10 Apr 2013 00:42:28 +0530
<< EHLO localhost
>> 250-nsmtpin.xxxxb.co.in Hello localhost ([10.2.252.251]), pleased to meet you
>> 250-HELP
>> 250-SIZE 5324800
>> 250 PIPELINING
<< MAIL FROM:<xxxxx@xxxxB.com>
>> 250 xxxxxx@xxxxB.com... Sender OK
<< RCPT TO:<xxx@xxxxB.com>
>> 250 xxx@xxxxB.com... Recipient OK
<< DATA
>> 354 Enter message, end with "." on a line by itself
<< To: xxxx@xxxxB.com
<< From: xxx.xxx@xxxxB.com
<< Subject: Testing
<< Date: Wed, 10 Apr 2013 00:35:42 +0530
<< X-Mailer: Perl script "Email_Resender"
<<  using Mail::Sender 0.8.16 by Jenda Krynicky, Czechlands
<<  running on localhost (127.0.0.1)
<<  under account "root"
<< Message-ID: <20130409_190542_084621.Mitesh.Shah@xxxxB.com>
<< MIME-Version: 1.0
<< Content-type: multipart/related;
<<  boundary="Message-Boundary-by-Mail-Sender-1365534342"
<< 
<< This message is in MIME format. Since your mail reader does not understand
<< this format, some or all of this message may not be legible.
<< 
<< --Message-Boundary-by-Mail-Sender-1365534342
<< Content-Type: multipart/alternative; boundary="Part-Message-Boundary-by-Mail-Sender-1365534342_2"
<< 
<< 
<< --Part-Message-Boundary-by-Mail-Sender-1365534342_2
<< Content-type: text/html
<< Content-transfer-encoding: 7BIT
<< 
<<  
<< 
<<                          <!DOCTYPE html PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN>
<<                          <html>
<<                          
<<                          </html>
<< --Part-Message-Boundary-by-Mail-Sender-1365534342_2--
<< 
<< --Message-Boundary-by-Mail-Sender-1365534342
<< Content-type: image/jpeg; name="20130408_112508_2792230080_1_4.jpg"
<< Content-description: fax1 jpg
<< Content-transfer-encoding: base64
<< Content-disposition: attachment; filename=08042013/20130408_112508_2792230080_1_4.jpg;
<< 
<< /9j/4AAQSkZJRgABAQEAzABiAAD//gAbPFVOU1BFQ0lGSUVEPgoyNzkyMjMwMDgwCv/bAEMABQME
<< BAQDBQQEBAUFBQYHDAgHBwcHDwsLCQwRDxISEQ8RERMWHBcTFBoVEREYIRgaHR0fHx8TFyIkIh4k
<< HB4fHv/AAAsIA+gDIAEBEQD/xAAdAAEAAgMBAQEBAAAAAAAAAAAABQYDBAcCAQgJ/8QAdhAAAQME
<< fWbj6/DL+rsQgf8Ad/VX4L6Wzr/beo2PTcWQpy9N3Fn0JtP/AGRwrACD9St8T9RNf1yRy4DkAFa7
<< gHeqj8nvVvxzHbhfrq+GINvjrkPrPsQkbOvefYB7yK578HfqZL6lYhMeukL4qv0N7b8UoIKWHh4s
<< jkjkT7dBQH2VhR8HzCUFRRdcxSVq5K1kcobPbufW8+wr1/g/4Z/S+Z/rLK/aqUt3RXBokRLDjF2m
<< qDnPxpd3kuOEfilXMer9VbbXSHAkNpQbQ+spAHJdxklR+snxO5r180eA/wBCufeEn95T5o8B/oVz
<< 7wk/vKfNHgP9CufeEn95T5o8B/oVz7wk/vKfNJgP9CufeEn95Uc50G6QuuKcdwKzOOLJUpa0KUpR
<< PmSSrZP1mvnzBdHfzfWP/ZK/aoOgfR4EEdPrHsHf8ir++p+P0z6exw8GsKx5Pjnbn+5zR3217U9u
<< 3u1Wdvp9giEJQnDcd4pAA/3LYPYf/Fr78gMG/I3Hfutj9inyAwb8jcd+62P2KfIDBvyNx37rY/Yp
<< 8gMG/I3Hfutj9ivbWC4U0dtYjYEE+1NsYH/5Ne/kViHLl8lrHsjW/i5ny/1ayxcTxiLJbkxsdtDD
<< zSgttxuC0lSFDyIITsH6xUzxH1/aacR9f2mvoGvf9tKUpSlKUr//2Q==
<< quit
4

1 回答 1

0

你说

如果我发送 10 封邮件,只有 2 封邮件成功发送,其余邮件收到此错误。

我的代码工作了 6 个月以上,从昨天开始我就遇到了这个问题

这表明它不是您的代码,而是与网络或邮件服务器有关。您将需要捕获调试输出停止工作的部分,以查看到底发生了什么。

这很可能是邮件服务器上的速率限制设置,在这种情况下,每条消息之间的短暂暂停(或不并行发送大量消息)应该会有所帮助。此外 - 当提交无效消息/地址时,某些邮件服务器可能会开始拒绝/减慢连接。

于 2013-04-10T07:15:38.663 回答