Zend_mail成功消息来了,但邮件没有发送

时间:2015-02-06 08:13:51

标签: php email zend-mail

我已经使用脚本发送邮件了,一切看起来都很好,甚至我得到了成功消息但遗憾的是电子邮件没有发送..任何机构都可以查找此代码中的任何失误

代码

$body = "This is testmail please ignore";
$mail = new Zend_Mail ();
$tr = new Zend_Mail_Transport_Sendmail ( '-f' . $sentFromEmail );
Zend_Mail::setDefaultTransport ( $tr );
$mail->setReturnPath("user@admin.com");
$mail->setFrom ( "user@admin.com", 'Reporters' );
$mail->setBodyHtml ( $body );
$mail->addTo ( "samjam@gmail.com"  );
$mail->setSubject ( "Weekly Report" );
try {
    $mail->send ();
    echo "Success";
} catch ( Exception $e ) {
    echo "Mail sending failed.\n";
}

SMTP配置

 if (isset($config['ssl'])) {
            switch (strtolower($config['ssl'])) {
                case 'tls':
                    $this->_secure = 'tls';
                    break;

                case 'ssl':
                    $this->_transport = 'ssl';
                    $this->_secure = 'ssl';
                    if ($port == null) {
                        $port = 465;
                    }
                    break;

            }
        }


        if ($port == null) {
            if (($port = ini_get('smtp_port')) == '') {
                $port = 25;
            }
        }

0 个答案:

没有答案