I'm trying to use PHPmailer to send mails. My webhost has said if the mail is relayed through their datacenter, no credentials are required. This is my code:
$mail->SMTPOptions = array(
'ssl' => array(
'verify_peer' => false,
'verify_peer_name' => false,
'allow_self_signed' => true
)
);
$mail->SMTPSecure = 'ssl';
$mail->SMTPDebug = 2;
$mail->isSMTP();
$mail->Host = 'smtpgateway.webhost.com';
$mail->SMTPAuth = false;
$mail->SMTPSecure = false;
$mail->port = 25;
$mail->setFrom('[email protected]', 'Test');
$mail->Subject = $email_subject;
$mail->Body = $email_body;
$mail->addAddress($email, $name);
$mail->isHTML(true);
if($mail->send())
{
echo "Success";
}
But I get this error when trying to send email:
2018-08-21 10:07:03 CLIENT -> SERVER: MAIL FROM: [email protected]
2018-08-21 10:07:03 SERVER -> CLIENT: 250 OK
2018-08-21 10:07:03 CLIENT -> SERVER: RCPT TO:[email protected]
2018-08-21 10:07:03 SERVER -> CLIENT: 550-Please turn on SMTP Authentication in your mail client. (mydomain.com)550-[10.100.15.115]:41032 is not permitted to relay through this server without550 authentication.
2018-08-21 10:07:03 SMTP ERROR: RCPT TO command failed: 550-Please turn on SMTP Authentication in your mail client (mydomain.com)550-[10.100.15.115]:41032 is not permitted to relay through this server without550 authentication.
$mail->SMTPAuth = false;??? - RiggsFolly$mail->SMTPSecure = 'tls';set? Try it with$mail->SMTPAuth = true;and a userid and pasword, see if the error message changes - RiggsFolly