Godaddy c-panel中php邮件的问题

时间:2016-10-12 11:45:44

标签: php

以下代码在localhost中工作正常但在Godaddy中服务器(c-panel)收件人没有收到任何邮件

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();

1 个答案:

答案 0 :(得分:1)

GoDaddy使用SSL的外发SMTP是端口465.是的,正式弃用,但看here,他们仍然使用它。