Quantcast
Channel: Active questions tagged email - Stack Overflow
Viewing all articles
Browse latest Browse all 30364

Get copy to sender with correct email adress / phpmailer

$
0
0

i using a very simple phpmailer script for a contact page.

<?phpif( isset($_POST['name']) ){    $to = 'info@xxx.xxxx'; // Replace with your email    $subject = $_POST['subject'];    $message = $_POST['message'] . "\n\n" . 'Regards, ' . $_POST['name'] . '.';    $headers = 'From: ' . $_POST['email'] . "\r\n" . 'Reply-To: ' . $_POST['email'] . "\r\n" . 'X-Mailer: PHP/' . phpversion();    mail($to, $subject, $message, $headers);    if( $_POST['copy'] == 'on' )    {        mail($_POST['email'], $subject, $message, $headers2);    }}?>

but the issue is, that if copy is send, it has wrong "from" header details...so in example:

From: yakashimoto@xzy.xxReply to: yakashimoto@xzy.xxTo: yakashimoto@xzy.xx
but i needFrom: info@xxx.xxxreply to: info@xx.xxxto: yakashimoto@xyz.xx

Viewing all articles
Browse latest Browse all 30364

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>