简体   繁体   中英

PHPMailer error(s)

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

The above code keeps giving me the error, "Mailer Error: Language string failed to load: recipients_failedandrew@yahoo.co.uk". I have tried changing the AddAddress(). The smtp connection settings are correct, as this was the last error i had! Any help would be much appreciated. Thanks

It sounds like you have two problems.

1) Your language file isn't being loaded - see installation

2) The recipient is being rejected - errr double check the SMTP settings and the recipient address

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM