phpmailer没有向gmail发送邮件

时间:2012-08-08 00:44:04

标签: gmail phpmailer

我有一个电子邮件程序,它从一个正在运行的cron运行,现在却没有。好吧,它仍然有效,但它不会向Gmail发送任何电子邮件。我在gmail的过滤器中设置过滤器,将所有电子邮件从“我的域名”发送到我的收件箱而不是垃圾邮件文件夹,但现在他们甚至都没有转到垃圾邮件文件夹。它适用于yahoo和textfree.us。

以下是代码:

$alerttarget = $usersemail;
$subject = "A bill is OVERDUE!";
$body = "You have an overdue bill, in the amount of $" . $amount . ".";
$from = $userId . date("YmdHis") . $billdetailId . "b@mydomain.com";

sendemail($alerttarget, $body, $from, $subject);

function sendemail($target, $body, $from, $subject)
{

    $mail = new PHPMailer();

    $email = $target;

    $mail->IsSMTP(); // telling the class to use SMTP
    $mail->Host       = "localhost"; // SMTP server
    $mail->SMTPDebug  = 2; // enables SMTP debug information (for testing)
    $mail->SetFrom($from, "my domain");
    $mail->AddReplyTo($from, "my domain");

    $mail->Subject    = $subject;

    $mail->MsgHTML($body);

    $address = $email;
    $mail->AddAddress($address, "me");


    if(!$mail->Send()) {
        echo "Mailer Error: " . $mail->ErrorInfo;
    } else {
        echo "Message sent!";
    }
}

我最近买了一个新域名,并将主机设置为指向我的IP地址。我是用godaddy的DNS经理做的。但是,我只设置主机指向我的IP地址;没有其他的。然而,在我完成所有这些之前,它停止了工作。

0 个答案:

没有答案
相关问题