0

これはお問い合わせフォームに関連しています。メールのコピーをユーザーにも送信しようとしています。

だから私は同じ機能を置き換えると思ったので、if(!isset($hasError))2回目を繰り返して変更しました$emailTo = $email

これは機能していません。ヘッダーに問題がある可能性があります... 2 つの異なるヘッダー タグを記述できますか?

// to me        
    if(!isset($hasError)) {

        $emailTo = 'myemail@website.com';
        $subject = 'Submitted message from '.$name;
        $sendCopy = trim($_POST['sendCopy']);
        $body = "Name: $name \n\nEmail: $email \n\nComments: $comments";
        $headers = 'From: ' .' <'.$emailTo.'>' . "\r\n" . 'Reply-To: ' . $email;

        mail($emailTo, $subject, $body, $headers);

        $emailSent = true;
    }

//User Copy

if(!isset($hasError)) {
    $emailTo  = '$email';
    $subject = 'Thank you for Contacting';

    $body = "Here is your copy of email which you have sent us. \n\nName: $name \n\nEmail: $email \n\nComments: $comments \n\n Thank you for your email. we will get back to your soon";

    $headers = 'From: ' .' <'.$emailTo.'>' . "\r\n" . 'Reply-To: ' . $email;

     mail($emailTo, $subject, $body, $headers);

    $UserEmailSent = true;

}
4

0 に答える 0