I'm using PHPMailer to send email via SMTP on a shared server (my hosting service is Softsys). Email is being sent fine to email addresses on the same server (i.e. the @ domain is my webdomain). However, when I try to change the recipient to @gmail (or any external address) I get the following error log:
SMTP -> get_lines(): $data was ""
SMTP -> get_lines(): $str is "550 <[email protected]> No such user here"
SMTP -> get_lines(): $data is "550 <[email protected]> No such user here"
SMTP -> FROM SERVER:550 <[email protected]> No such user here
SMTP -> ERROR: RCPT not accepted from server: 550 <[email protected]> No such user here
SMTP -> get_lines(): $data was ""
SMTP -> get_lines(): $str is "250 OK"
SMTP -> get_lines(): $data is "250 OK"
SMTP -> FROM SERVER: 250 OK
Message could not be sent.
Mailer Error: SMTP Error: The following recipients failed: [email protected]
Is this an issue with my server or my code? Should I just contact my server admin? Thank you in advance for any help!
Here's my code
require("class.phpmailer.php");
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->Host = "mail.mywebsite.com";
$mail->SMTPAuth = true;
$mail->Username = "myemail";
$mail->Password = "********";
$mail->From = "[email protected]";
$mail->FromName = "John Doe";
$mail->AddAddress("[email protected]");
$mail->IsHTML(true);
$mail->Subject = "Here is the subject";
$mail->Body = "This is the HTML message body <b>in bold!</b>";
$mail->AltBody = "This is the body in plain text for non-HTML mail clients";
if(!$mail->Send())
{
echo "Message could not be sent. <p>";
echo "Mailer Error: " . $mail->ErrorInfo;
exit;
}
echo "Message has been sent";