moved server cannot send email using smtp in php app

jimlongo

Well-Known Member
Mar 20, 2008
289
24
68
I recently migrated servers.

I have a couple of installations of phpList that I use to send newsletters for various clients.
Before the move I was using a config that looks something like this and was working fine.

Code:
define("PHPMAILERHOST",'vps.mydomain.com');
$phpmailer_smtpuser = '[email protected]';
$phpmailer_smtppassword = 'xxxxxxxxxx';
define('PHPMAILERPORT',465);

After the move when I try to send email it would fail to send the message.
There are no php errors, or errors in any logs that I can find.

As a workaround I changed the config to the following which forces the application to use PHP mail() to send and that works fine.
Code:
define("PHPMAILERHOST",'');

Any ideas what I can look at to enable sending via SMTP?

Thanks.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,268
463
Hello :)

I recommend finding an alternate test PHP script for sending email via SMTP to rule out any issues with your specific script. Also, try changing the host to "localhost" instead of the hostname of your system.

Thank you.
 

jimlongo

Well-Known Member
Mar 20, 2008
289
24
68
Thanks I tried a vanilla PHPMailer script and this configuration failed, UNLESS 'ssl' is capitalized.

I will investigate my script further, but it worked before migration.

Code:
$mail->Host = 'vps.mydomain.com'; 
$mail->SMTPAuth = true;          
$mail->Username = '[email protected]';  
$mail->Password = 'xxxxxxxxxx';   
$mail->SMTPSecure = 'SSL';
Also adding the port causes a fail with a message "SMTP NOTICE: EOF caught while checking if connected SMTP connect() failed."
$mail->Port = 465;