perl Net :: SMTP :: TLS使页面加载挂起

时间:2015-07-09 19:59:43

标签: perl cgi perl-module

我有一个用Perl编写的相当冗长的多功能CGI脚本,我使用Perl模块Net::SMTP::TLS来执行邮件操作。

我在子例程中有use NET:SMTP:TLS语句,但只在某些操作上调用此子例程。由于某种原因,它导致页面挂起并加载〜15秒。

有谁知道为什么会这样,或者更好的是如何解决这个问题?

sub sendMail{

use Net::SMTP::TLS;

$mctype = "Content-type: text/html\n\n";
$msubject = "Subject: $subject\n";
$mfrom = "From: \"$from\n";
$mto = "To: \"$to\n";
$mheaders = $mfrom . $mto . $msubject . $mctype . "\n";
$memail = $mheaders . $mbody;

$muname="*NOT DISCLOSED*";
$mupass="*NOT DISCLOSED*";
$mailer = new Net::SMTP::TLS('mailrelay.host.com',
   Hello => 'ssrs.reachmail.net',
   Port => 587,
   User => $muname,
   Password => $mupass,
   Timeout => 60,
   Debug => 1);
$mailer->mail("$from");
$mailer->to("$to");
$mailer->data();
$mailer->datasend($memail);
$mailer->dataend(); 
$mailer->quit;
}

0 个答案:

没有答案