简体   繁体   中英

Issues with php mailer in Godaddy c-panel

Below code is working fine in localhost But in Godaddy
server(c-panel) recipient didn't receive any mail

require_once('PHPMailer-master/PHPMailerAutoload.php');
$mail = new PHPMailer;
$mail->SMTPDebug = 2;                        // Enable verbose debug output
$mail->isSMTP();                            // Set mailer to use SMTP 
$mail->Host = 'smtp.gmail.com';             // Specify main and backup SMTP 
                                            // servers
$mail->SMTPAuth = true;                       // Enable SMTP  authentication
$mail->Username = 'testingpavanbrill@gmail.com';  // SMTP username
$mail->Password = '*********';                   // SMTP password
$mail->SMTPSecure = 'tls';                   // Enable TLS encryption, ssl` also accepted
$mail->Port = 587;                               // TCP port to connect to
$mail->setFrom('dontreply@socialmedia.com', 'Social Media');
$mail->addAddress($email);                       // Add a recipient
$mail->addReplyTo('socialmedia@socialmedia.com', 'Social Media');
$mail->isHTML(true);                             // Set email format to HTML
$mail->Subject = $subject;
$mail->Body    = $message;  
$mail->AltBody = $message;
$mail->Send();

GoDaddy 使用 SSL 的外发 SMTP 是端口 465。是的,官方已弃用,但请看这里,他们仍在使用它。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM