problem w/ PHPMailer

mgrunk

Perch
Ok, my last problem was my error but now I am unable to send messages to email addresses outside the domain:

Message was not sentMailer Error: Language string failed to load: [email protected]

My code:
require("class.phpmailer.php");
$mail = new PHPMailer();
$mail->IsSMTP(); // telling the class to use SMTP
$mail->Host = "mail.mydomain.com"; // SMTP server
$mail->From = $from_email;
$mail->FromName = $name;
$mail->AddAddress("contact@mydomain");
$mail->AddAddress("contact@outsidedomain");
$mail->Subject = $reason;
$mail->Body = $message;
$mail->WordWrap = 50;

if(!$mail->Send())
{
echo "Message was not sent";
echo "Mailer Error: " . $mail->ErrorInfo;
}
else
{
echo "Message has been sent";
}

So, when I take out the second addaddress - I get the email ok, but if I add the second, or I change the first to send a message to an email address outside the domain of the mail server, it fails w/ the above message.
 
You will need smtp-auth in case of mailserver. If you use local SMTP as "localhost", it will work for both local and remote domains.
 
Back
Top