I noticed that my server has been returning this error when trying to send email to an invalid domain:
Standard Message: Failed to set sender: email@example.com [SMTP: Invalid response code received from server (code: 553, response: 5.1.8 ... Domain of sender address firstname.lastname@example.org does not exist)] Standard Code: 10004 DBMS/User Message: DBMS/Debug Message:
Is there a way to check the domain first before attempting to send the email? I have a feeling I could also handle this on the SMTP server end by squelching this error, but I like the idea of being able to test an email domain first before sending it. Thanks for your ideas!
Here is the pertinent code just for reference (variables are filtered in from a form):
$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);