Php 显示';s电子邮件成功,但未收到电子邮件godaddy

Php 显示';s电子邮件成功,但未收到电子邮件godaddy,php,phpmailer,Php,Phpmailer,你好,当我在本地主机上使用phpmailer时,它可以工作,但由于某种原因,当我使用GoDaddy的主机时,它将不再工作 我已经关注了几乎所有与此相关的内容,但似乎找不到任何解决方案: require 'PHPMailerAutoload.php'; $mail = new PHPMailer; $message = "Test"; $mail->isSMTP(); $mail->Host = 'relay-hosting.secureserver.net'; $mail->

你好,当我在本地主机上使用phpmailer时,它可以工作,但由于某种原因,当我使用GoDaddy的主机时,它将不再工作

我已经关注了几乎所有与此相关的内容,但似乎找不到任何解决方案:

 require 'PHPMailerAutoload.php';
$mail = new PHPMailer;
$message = "Test";
$mail->isSMTP(); 
$mail->Host = 'relay-hosting.secureserver.net';
$mail->SMTPAuth = true;
$mail->Username = 'mycpanelusername'; 
$mail->Password = 'mycpanelpassword';
$mail->SMTPSecure = 'ssl';
$mail->Port = 25; 
$mail->setFrom('testemail@gmail.com', 'Mailer');
$mail->addAddress($email, 'Joe User');
$mail->addAddress('ellen@example.com');
$mail->addReplyTo('info@example.com', 'Information');
$mail->addCC('cc@example.com');
$mail->addBCC('bcc@example.com');
$mail->addAttachment('/var/tmp/file.tar.gz');  
$mail->addAttachment('/tmp/image.jpg', 'new.jpg');
$mail->isHTML(true);  
$mail->Subject = 'Here is the subject';
$mail->Body    = $message ;
$mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
if(!$mail->send()) {
    echo 'Message could not be sent.';
    echo 'Mailer Error: ' . $mail->ErrorInfo;
} else {
    echo 'Message has been sent';
}

您必须使用此选项来实际发送电子邮件,最后:

$mail->send();
要获取更多信息:

if(!$mail->send()) {
    echo 'Message could not be sent.';
    echo 'Mailer Error: ' . $mail->ErrorInfo;
} else {
    echo 'Message has been sent';
}

很抱歉,我已经更新了代码,它没有显示错误。您是否检查了垃圾邮件或垃圾邮件文件夹?SMTPSecure='ssl'不太可能在端口25上工作。使用SMTPDebug=2发布您看到的内容。