I am working on a website with a form that is used to send email with PHPMailer. i have a GoDaddy hosting plan linux. I have tried multiple ways without any success, some time ago it worked and now does not work.
Configuration 1 with Gmail
include_once('phpmailer/class.phpmailer.php');
include_once('phpmailer/class.smtp.php');
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPAuth = false;
$mail->SMTPSecure = false; (I've tried the 2 options)
$mail->Host = "relay-hosting.secureserver.net";
$mail->Port = 25;
$mail->Username ='[email protected]';
$mail->Password = 'xxxxxxx';
$mail->Subject = 'Form from website';
$mail->AddAddress("[email protected]");
$mail->FromName = "formsite";
$mail->SMTPDebug = 3;
$mail->Debugoutput = 'html';
Log
Connection: opening to relay-hosting.secureserver.net:25, timeout=300, options=array ()
SMTP ERROR: Failed to connect to server: Connection refused (111) SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
Configuration 2 email from the same domain
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPSecure = true; // Enable TLS encryption, `ssl` also accepted
$mail->SMTPAuth = false; // Enable SMTP authentication
$mail->SMTPOptions = array(
'ssl' => array(
'verify_peer' => false,
'verify_peer_name' => false,
'allow_self_signed' => true
)
);
$mail->Host = 'p3plcpnxxx.prod.phx3.secureserver.net';
$mail->Port = 465;
$mail->Username ='[email protected]';
$mail->Password = 'xxxxxxxx';
$mail->Subject = 'Form from website';
$mail->AddAddress("[email protected]");
$mail->FromName = "formsite";
$mail->SMTPDebug = 3;
$mail->Debugoutput = 'html';
Log
SERVER -> CLIENT: 220-p3plcpnxxxx.prod.phx3.secureserver.net ESMTP Exim 4.89 #1 Thu, 14 Dec 2017 21:11:11 -0700 220-We do not authorize the use of this system to transport unsolicited, 220 and/or bulk e-mail.
CLIENT -> SERVER: EHLO www.xxxxxx.com
SERVER -> CLIENT: 250-p3plcpnxxxx.prod.phx3.secureserver.net Hello p3plcpnxxxx.prod.phx3.secureserver.net [180.168.200.196]250-SIZE 52428800250-8BITMIME250-PIPELINING250-AUTH PLAIN LOGIN250-CHUNKING250 HELP
SMTPSecure = true
should beSMTPSecure = 'ssl'
; Don't just make up values and expect it to work - read the docs and code if you're unsure. You should not need to disable cert verification; GoDaddy shouldn't be publishing bad certs, and you should have up to date CA certificates. You're using an old version of PHPMailer, and you've based your code on an obsolete example, so get the latest. – Synchro