SMTP not working with php mailer class
I have two accounts:
no-reply@weddinggrabs.com no-reply@appovio.com
and
Incoming POP3: pop.secureserver.net (995)
Outgoing SMTP: smtpout.secureserver.net (80, 3535, 25, 465)
These works are used by mail clients like Thunderbird, post-box, etc., but not with php-mailer:
error_reporting(0);
require_once ("class.phpmailer.php");// PHP MAILER FOR SENDING EMAILS
$mail = new PHPMailer();
define('EMAIL_HOST','smtpout.secureserver.net');
define('EMAIL_USER','no-reply@weddinggrabs.com');
define('EMAIL_PASSWORD','xxxxxxxx');
$mail->IsSMTP();
$mail->Port = 465;
$mail->Host = EMAIL_HOST;
$mail->Username = EMAIL_USER;
$mail->Password = EMAIL_PASSWORD;
$mail->SMTPAuth = true;
$mail->FromName = "Administrator";
$mail->From = "Administrator";
$mail->AddAddress($email);
$mail->WordWrap = 50;
$mail->IsHTML(true);
$mail->Subject = "Seating Arrangements on Event";
$mail->Body = "Dear WeddingWire Customer";
if($mail->Send()) return "true";
return "false";
source to share
Using this information, you configure phpmailer as follows:
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->SMTPDebug = 2; // enables SMTP debug
$mail->SMTPSecure = "ssl"; // sets the prefix to the servier
I think it will be helpful for you. either it will work or show that the real problem comes in your mail. If that doesn't work, check a few things.
- Does your host have permission to relay through SMTP host?
- Does your host require POP before SMTP?
- Does your host require SMTP authentication?
source to share
From the server hosting this file, does smtpout.secureserver.net resolve correctly? Try pinging and see if the IP address you expect is there
Barring me PHPMailer () uses exceptions if you pass a "true" parameter to it, so try something like:
$mail = new PHPMailer(true);
try
{
$mail->IsSMTP();
$mail->Port = 465;
$mail->Host = EMAIL_HOST;
$mail->Username = EMAIL_USER;
$mail->Password = EMAIL_PASSWORD;
$mail->SMTPAuth = true;
$mail->FromName = "Administrator";
$mail->From = "Administrator";
$mail->AddAddress($email);
$mail->WordWrap = 50;
$mail->IsHTML(true);
$mail->Subject = "Seating Arrangements on Event";
$mail->Body = "Dear WeddingWire Customer";
$mail->Send();
} catch( phpmailerException $e ) {
echo $e->errorMessage();
exit(0);
}
What should be rented gives you an idea of the error.
source to share