当发件人email-id是yahoo id时,尚未发送邮件

时间:2014-06-11 06:56:10

标签: php email

当我将发件人电子邮件地址放在yahoo id以外时,邮件已发送并发送。它也适用于雅虎接收器。在脚本中,当我使用Gmail作为发件人时,雅虎收到但不是反之亦然,即雅虎发件人不能在Gmail中提供。

这是我的代码中的服务器问题还是错误?

这是我的代码

$mail = new PHPMailer();
$mail->isMail(true);
$mail->IsHTML(true);    
$mail->AddEmbeddedImage('img/logo.png', 'logo');
$mail->AddEmbeddedImage('img/plunder_icon.png', 'icon');
$to = 'nabina.smartmobe@gmail.com'; // receiver email
$mail->AddAddress($to);
$from = 'nvn_shahi@yahoo.com';
$user_name = 'Nabina';
$mail->SetFrom($from,$user_name);
$mail->AddReplyTo($from,$user_name);

$subject = 'Hi';
$msg = 'test';
$mail->Subject    = $subject;
$msg = get_mail_format($msg);
$mail->Body = $msg;
try{
    if($mail->Send()){

        return true;
    }else{

        return false;
    }


} catch(Exception $e){
    //Something went bad
    echo "Fail - " . $mail->ErrorInfo; die;
}  

1 个答案:

答案 0 :(得分:0)

继续我的回答,正如PHPMailer所说,请检查以下示例并将其添加到您的代码中:

$mail->isSMTP();                                      // Set mailer to use SMTP
$mail->Host = 'smtp1.example.com;smtp2.example.com';  // Specify main and backup SMTP servers
$mail->SMTPAuth = true;                               // Enable SMTP authentication
$mail->Username = 'user@example.com';                 // SMTP username
$mail->Password = 'secret';                           // SMTP password
$mail->SMTPSecure = 'tls';                            // Enable encryption, 'ssl' also accepted