Skip to main content
Help Center
The GoDaddy Community will undergo maintenance starting on Tuesday, August 3rd at 3pm PST / 6pm EST. Learn more
Showing results for 
Show  only  | Search instead for 
Did you mean: 

PHPMailer smtp mail sending error

I am facing problem in sending mails using phpmailer in godaddy hosting(Plesk). Every thing was working correctly for many months. After some months I tried its not working now. I contacted go daddy team but they are not able to help me. I am getting an error message "Message rejected for restricted from domain". Please help me with this problem. I am sharing my code and error image2020-02-18.png2020-02-18 (1).png



// Import PHPMailer classes into the global namespace
// These must be at the top of your script, not inside a function
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;

//Load Composer's autoloader
require './vendor/autoload.php';

$mail = new PHPMailer(true); // Passing `true` enables exceptions
try {
//Server settings
$mail->SMTPDebug = 2; // Enable verbose debug output
$mail->Host = '';
$mail->Port = 25;
$mail->SMTPAuth = false;
$mail->SMTPSecure = false;
$mail->Username = ''; // SMTP username
$mail->Password = 'XXXXXX';

$mail->setFrom('', 'Admin');
$mail->addAddress('', 'Joe User'); // Add a recipient

$mail->isHTML(true); // Set email format to HTML
$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';

echo 'Message has been sent';
} catch (Exception $e) {
echo 'Message could not be sent. Mailer Error: ', $mail->ErrorInfo;