I cannot send email with phpmailer on cpanel

  • Answered
When I entered these to send email with phpmailer on cpanel,
require 'phpmailer/PHPMailerAutoload.php';

$mail = new PHPMailer;

$mail->Host = 'srv1.iphosting.co';
$mail->SMTPAuth = true;
$mail->Username = '[email protected]';
$mail->Password = '************';
$mail->SMTPSecure = 'ssl';
$mail->Port = 465;
I received the following errors:
Message could not be sent.Mailer Error: SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting

Please help me out. Thanks
Hello busnurd,

Sorry to hear you are having issues with your phpmailer's SMTP conection. The documentation link you provided says "It means that PHPMailer is unable to contact the SMTP server you have specified in the Host property". You will want to first ensure all credentials are correct. If not, you will want to check the documentation link provided to see what steps to take next, such as adding additional parameters for more thorough error reporting.

Kindest Regards,
Scott M