duanchun6148 2014-09-17 16:16
浏览 22

为什么我仍然让雅虎反弹错误?

I'm getting yahoo bounceback errors when submitting a test email in my form using a yahoo email address and sending to a gmail address.

I know that yahoo throws errors when using the phpmailer "FROM", but what I've read online, including here, says to use "SETFROM". The email is sent, but the from is blank. How can I still pass in the users email and send him a copy of the form? I'm currently using a bcc to send him a copy of the email.

<?php
session_start();

include("php/simple-php-captcha/simple-php-captcha.php");
include("php/php-mailer/class.phpmailer.php");


// Step 1 - Enter your email address below.
$to = 'info@novawebdev.com';

$arrResult = array('response'=>'');

if(isset($_POST['emailSent'])) {

    $subject = 'RTO Camera Application';

    // Step 2 - If you don't want a "captcha" verification, remove that IF.
    if (strtolower($_POST["captcha"]) == strtolower($_SESSION['captcha']['code'])) {

        $first_name = $_POST['first_name'];
        $last_name = $_POST['last_name'];
        $business_name = $_POST['business_name'];
        $phone = $_POST['phone'];
        $email = $_POST['email'];
        $merchantid = $_POST['merchantid'];

        // Step 3 - Configure the fields list that you want to receive on the email.
    $fields = array(
        0 => array(
            'text' => 'First Name',
            'val' => $_POST['first_name']
        ),
        1 => array(
            'text' => 'Last Name',
            'val' => $_POST['last_name']
        ),
        2 => array(
            'text' => 'Business Name',
            'val' => $_POST['business_name']
        ),
        3 => array(
            'text' => 'Phone Number',
            'val' => $_POST['phone']
        ),
        4 => array(
            'text' => 'Email',
            'val' => $_POST['email']
        ),
        5 => array(
            'text' => 'Merchant ID',
            'val' => $_POST['merchantid']
        )
    );

    $message = "";

    // foreach($fields as $field) {
        // $message .= $field['text'].": " . htmlspecialchars($field['val'], ENT_QUOTES) . "<br>
";
    // }

$mail = new PHPMailer;

    $mail->IsSMTP();

    // Step 4 - If you don't receive the email, try to configure the parameters below:

    //$mail->Host = 'mail.yourserver.com';                // Specify main and backup server
    //$mail->SMTPAuth = true;                             // Enable SMTP authentication
    //$mail->Username = 'username';                       // SMTP username
    //$mail->Password = 'secret';                         // SMTP password
    //$mail->SMTPSecure = 'tls';                          // Enable encryption, 'ssl' also accepted

    $mail->SetFrom($email, $first_name, $last_name);
    $mail->FromName = $_POST['first_name'].' '.$_POST['last_name'];
    $mail->AddAddress($to);
    $mail->AddReplyTo($email, $first_name, $last_name);
    $mail->AddBCC($email);
    $mail->IsHTML(true);

    $mail->CharSet = 'UTF-8';

    $mail->Subject = $subject;
    $mail->Body    = $message;  

    if($mail->Send()) {
       $arrResult['response'] = 'success';
    } else {
        $arrResult['response'] = 'error';
    }

} else {

    $arrResult['response'] = 'captchaError';

    }
}
?>
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 请问我该如何添加自己的数据去运行蚁群算法代码
    • ¥20 用HslCommunication 连接欧姆龙 plc有时会连接失败。报异常为“未知错误”
    • ¥15 网络设备配置与管理这个该怎么弄
    • ¥20 机器学习能否像多层线性模型一样处理嵌套数据
    • ¥20 西门子S7-Graph,S7-300,梯形图
    • ¥50 用易语言http 访问不了网页
    • ¥50 safari浏览器fetch提交数据后数据丢失问题
    • ¥15 matlab不知道怎么改,求解答!!
    • ¥15 永磁直线电机的电流环pi调不出来
    • ¥15 用stata实现聚类的代码