I'm trying to set up a fairly simple mailing form to allow admins to send emails to different selection lists within databases. When tested to addresses on the same server (different domain) they work fine - when sent outside they fail with:
"
This message was created automatically by mail delivery software.
A message that you sent could not be delivered to one or more of its recipients. This is a permanent error. The following address(es) failed:
[email protected]
SMTP error from remote mail server after end of data:
host mail.xxxxx.uk.com [xx.xxx.xxx.xxx]: 554 Message is not RFC compliant
------ This is a copy of the message, including all the headers. ------
Return-path: <[email protected]>
Received: from telford.theukhost.net ([213.175.xxx.xx]:46254 helo=localhost)
by telford.theukhost.net with esmtpsa (TLSv1:AES256-SHA:256)
(Exim 4.69)
(envelope-from <[email protected]>)
id 1Q9alV-0000fu-HO
for [email protected]; Tue, 12 Apr 2011 11:24:09 +0100
From: [email protected]
To: [email protected]
Subject: Test
Test to outside
The relevant bit of the php script is:
while ($row = mysqli_fetch_assoc($emailqueryresult))
{
echo "mailing to:". $row['Email2']."<br />";
$to = trim($row['Email2']);
$body = "Dear {$row['Title']} {$row['Last_Name']} \n\n $message";
$headers = array ('From' => $from,
'To' => $to,
'Subject' => $subject);
$smtp = Mail::factory('smtp',
array ('host' => $host,
'auth' => true,
'username' => $username,
'password' => $password));
$mail = $smtp->send($to, $headers, $body);
if (PEAR::isError($mail)) {
echo("<p>" . $mail->getMessage() . "</p>");
} else {
echo("<p>Message successfully sent!</p>");
}
}
Any ideas gratefully received!!
Thanks
Philip
"
This message was created automatically by mail delivery software.
A message that you sent could not be delivered to one or more of its recipients. This is a permanent error. The following address(es) failed:
[email protected]
SMTP error from remote mail server after end of data:
host mail.xxxxx.uk.com [xx.xxx.xxx.xxx]: 554 Message is not RFC compliant
------ This is a copy of the message, including all the headers. ------
Return-path: <[email protected]>
Received: from telford.theukhost.net ([213.175.xxx.xx]:46254 helo=localhost)
by telford.theukhost.net with esmtpsa (TLSv1:AES256-SHA:256)
(Exim 4.69)
(envelope-from <[email protected]>)
id 1Q9alV-0000fu-HO
for [email protected]; Tue, 12 Apr 2011 11:24:09 +0100
From: [email protected]
To: [email protected]
Subject: Test
Test to outside
The relevant bit of the php script is:
while ($row = mysqli_fetch_assoc($emailqueryresult))
{
echo "mailing to:". $row['Email2']."<br />";
$to = trim($row['Email2']);
$body = "Dear {$row['Title']} {$row['Last_Name']} \n\n $message";
$headers = array ('From' => $from,
'To' => $to,
'Subject' => $subject);
$smtp = Mail::factory('smtp',
array ('host' => $host,
'auth' => true,
'username' => $username,
'password' => $password));
$mail = $smtp->send($to, $headers, $body);
if (PEAR::isError($mail)) {
echo("<p>" . $mail->getMessage() . "</p>");
} else {
echo("<p>Message successfully sent!</p>");
}
}
Any ideas gratefully received!!
Thanks
Philip
Comment