我正在尝试使用PEAR邮件通过外部smtp服务器发送邮件。它似乎挂了一段时间,然后脚本结束。它输出我所有的"echo“语句,直到发送之后的语句。没有任何输出超过回声,表示“发送前”。谁能告诉我这里可能出了什么问题?(虚拟值替换smtp值)。未发送电子邮件。感谢您的帮助!
echo "start";
$n = $_POST['txtName'];
$e = $_POST['txtEmail'];
$t = 'Kenny <email@host.com>';
$f = 'Kenny <email@host.com>';
$s = 'CPA TEST';
$b = "name: $n email: $e";
include("mail.php");
echo "after include";
/* mail setup recipients, subject etc */
$recipients = $t;
$headers["From"] = $f;
$headers["To"] = $t;
$headers["Subject"] = $s;
$mailmsg = $b;
/* SMTP server name, port, user/passwd */
$smtpinfo["host"] = "my_smtp_host";
$smtpinfo["port"] = "25";
$smtpinfo["auth"] = true;
$smtpinfo["username"] = "my_email";
$smtpinfo["password"] = "my_password";
echo "before object";
/* Create the mail object using the Mail::factory method */
$mail_object =& Mail::factory("smtp", $smtpinfo);
echo "before send";
/* Ok send mail */
$send = $mail_object->send($recipients, $headers, $mailmsg);
echo "after send";
if (PEAR::isError($send)) { print($send->getMessage());}else{print "end";}
echo "done";
https://stackoverflow.com/questions/2284468
复制相似问题