0

現在、PHPMailer を使用して添付ファイル付きのメールを送信しようとしています。残念ながら、各スクリプトの実行には、メッセージの送信に約 60 秒かかります。ここに私のコードがあります:

 $time_start = microtime(true);
require_once('class.phpmailer.php');

$mail             = new PHPMailer(); // defaults to using php "mail()"


//$body             = file_get_contents('contents.html');
//$body             = eregi_replace("[\]",'',$body);

$mail->AddReplyTo("name@yourdomain.com","First Last");

$mail->SetFrom('name@yourdomain.com', 'First Last');

$mail->AddReplyTo("name@yourdomain.com","First Last");

$address = "xxx@gmail.com";
$mail->AddAddress($address, "John Doe");

$mail->Subject    = "PHPMailer Test Subject via Sendmail, basic";

$mail->AltBody    = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test

$mail->MsgHTML("html body");

$mail->AddAttachment("abc.txt");      // attachment

if(!$mail->Send()) {
  echo "Mailer Error: " . $mail->ErrorInfo;
} else {
  echo "Message sent!";
}
$time_end = microtime(true);
$execution_time = ($time_end - $time_start);
echo 'Total Execution Time:'.$execution_time.' Sec';

実行時間はファイルサイズにあまり依存しませんが、60 秒のスクリプト実行時間は私には少し長すぎます。どうすればこれを修正できますか?

4

0 に答える 0