cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Highlighted

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

 

 

<?php
// 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->isSMTP();
$mail->Host = 'relay-hosting.secureserver.net';
$mail->Port = 25;
$mail->SMTPAuth = false;
$mail->SMTPSecure = false;
$mail->Username = 'XXXXXX@gmail.com'; // SMTP username
$mail->Password = 'XXXXXX';

$mail->setFrom('xxxxxx@gmail.com', 'Admin');
$mail->addAddress('xxxxxxxx@gmail.com', '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';

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

1 REPLY 1
Highlighted

Re: PHPMailer smtp mail sending error