I'm trying to send confirmation emails using Pear Mail.
The code I'm using seems to work - but only intermittently. I call the php file from within my browser and it fails. I hit F5 to refresh and then sometimes it works - sometimes it doesn't.
It seems to be working 3 or 4 times out of 10.
When it fails I get this message....
Warning: mail() [function.mail]: SMTP server response: 451 #4.1.8 Domain of sender address <firstname.lastname@example.org> does not resolve in C:\\PHP\\PEAR\\pear\\Mail\\mail.php on line 153
Does that make any sense to anyone ? and has anyone got any suggestions as to why this should be happening ?
// to remove the E_STRICT errors created by the PHP4 code in Mail
$text = "Text version of email\
Message made with PHP";
$html = '<html><body>HTML version of email<br />';
$html .= 'My Email <img src="12345" /></body></html>';
$crlf = "\
$hdrs = array(
'From' => 'email@example.com',
'Subject' => 'Test HTMl Email with Embedded Image'
$mime = new Mail_mime($crlf);
// set the text version of the email
// embed the image file
$mime->addHTMLImage('\\images\\flower.jpg', 'image/gif', '12345', true);
// set the HTML version of the email
//do not ever try to call these lines in reverse order
$body = $mime->get();
$hdrs = $mime->headers($hdrs);
$mail = Mail::factory('mail');
$succ = $mail->send('firstname.lastname@example.org', $hdrs, $body);
// Check for sending errors
echo 'Email sending failed: ' . $succ->getMessage();
echo 'Email sent succesfully';