PHPMailer错误

时间:2008-12-01 13:22:47

标签: php email

function register_contact ($person = array()) {
    $nogood = false;
    foreach ($person as $val) {
        if (strlen($val)==0) {
            $nogood = true;
            $status = "There was an error sending the registration please fill in all fields";
        }
    }
    if (!$nogood) {
        require_once("class.phpmailer.php");

        $message = "New request for Fox In Touch Recipient:.\r\n\r\n";
        $message .= "Forename: " . $person['fname'];
        $message .= "\r\nSurname: " . $person['sname'];
        $message .= "\r\nEmail: " . $person['email'];
        $message .= "\r\nJob Title: " . $person['job'];
        $message .= "\r\nCompany: " . $person['company'];
        $message .= "\r\n\r\nFox In Touch.";

        $mail = new PHPMailer();

        $mail->IsSMTP();                                   // send via SMTP
        $mail->Host     = "ahost"; // SMTP servers
        $mail->SMTPAuth = true;     // turn on SMTP authentication
        $mail->Username = "name";  // SMTP username
        $mail->Password = "pass"; // SMTP password
        //$mail->Post = 587;

        $mail->From     = "foxintouch@bionic-comms.co.uk";
        $mail->FromName = "Fox In Touch";
        //$mail->AddAddress("foxlicensing.europe@fox.com", "Fox Licensing");
        $mail->AddAddress("andrew@yahoo.co.uk", "Andrew");
        $mail->AddReplyTo("foxintouch@bionic-comms.co.uk","Information");
        $mail->IsHTML(false);                               // send as HTML

        $mail->Subject  =  "Contact request for Fox In Touch!";
        $mail->Body     =  $message;

        if(!$mail->Send()) {
            $nogood = true;
            $status = "Message was not sent <p>";
            $status .= "Mailer Error: " . $mail->ErrorInfo;
        } else {
            $status = "Thank you! Your message has been sent to 20th Century Fox. Submit another?"; 
        }
    }
    return array('email_failed'=>$nogood, 'status'=>$status);
}

上面的代码一直给我错误,“Mailer Error:语言字符串无法加载:recipients_failedandrew@yahoo.co.uk”。我试过更改AddAddress()。 smtp连接设置是正确的,因为这是我的最后一个错误!任何帮助将非常感激。感谢

1 个答案:

答案 0 :(得分:1)

听起来你有两个问题。

1)您的语言文件未加载 - 请参阅installation

2)收件人被拒绝 - 错误地检查SMTP设置和收件人地址