【发布时间】:2014-05-24 15:00:10
【问题描述】:
我注意到我的服务器在尝试向无效域发送电子邮件时返回此错误:
Standard Message: Failed to set sender: user@invaliddomain.coom [SMTP: Invalid response code received from server (code: 553, response: 5.1.8 ... Domain of sender address user@invaliddomain.coom does not exist)]
Standard Code: 10004
DBMS/User Message:
DBMS/Debug Message:
有没有办法在尝试发送电子邮件之前先检查域?我有一种感觉,我也可以通过消除此错误在 SMTP 服务器端处理此问题,但我喜欢能够在发送之前先测试电子邮件域的想法。感谢您的想法!
以下是相关代码,仅供参考(变量从表单中过滤):
$headers['To'] = $to_address;
$headers['From'] = $from;
$headers['Reply-To'] = $from;
$headers['Subject'] = $subject;
$this->setHTMLBody($body);
$body = $this->get(array('text_charset' => 'utf-8'));
$headers = $this->headers($headers, true);
$message =& Mail::factory('smtp');
$mail = $message->send($to_address,$headers,$body);
【问题讨论】: