Hello,
I have an issue with PHP form and how it sets email headers.
I would expect "where to send the email" would be just used where submission should be sent. But it asigns it to field "from".
There there's field "from" and when I leave it empty, it fills it up with email submitted in the form. But when I fill it up, then it sets it to "reply-to". It doesn't make sense.
private function _getEmailHeaders($toEmail, $formEmail) {
$headers = 'From: ' . $toEmail . PHP_EOL;
$headers .= 'Reply-To: ' . $formEmail . PHP_EOL;
$headers .= 'X-Mailer: PHP/' . phpversion() . PHP_EOL;
$headers .= 'Content-type: text/html; charset=utf-8' . PHP_EOL;
return $headers;
}
Let say:
I want submission to be sent to: emailA
I want to see it's sent from: emailB
And reply-to is set to: emailC (submitted by user)
I receive submission in emailA, but instead it's set:
sent from: emailA (should be emailB)
reply-to: emailB (should be emailC)
And emailC is just in the text of email I get.
If I leave field "from" empty, it correctly fills it with emailC, but I still want it to be sent from emailB so it doesn't look like spam.
Hello, I have an issue with PHP form and how it sets email headers. I would expect "where to send the email" would be just used where submission should be sent. But it asigns it to field "from". There there's field "from" and when I leave it empty, it fills it up with email submitted in the form. But when I fill it up, then it sets it to "reply-to". It doesn't make sense. private function _getEmailHeaders($toEmail, $formEmail) { $headers = 'From: ' . $toEmail . PHP_EOL; $headers .= 'Reply-To: ' . $formEmail . PHP_EOL; $headers .= 'X-Mailer: PHP/' . phpversion() . PHP_EOL; $headers .= 'Content-type: text/html; charset=utf-8' . PHP_EOL; return $headers; } Let say: I want submission to be sent to: emailA I want to see it's sent from: emailB And reply-to is set to: emailC (submitted by user) I receive submission in emailA, but instead it's set: sent from: emailA (should be emailB) reply-to: emailB (should be emailC) And emailC is just in the text of email I get. If I leave field "from" empty, it correctly fills it with emailC, but I still want it to be sent from emailB so it doesn't look like spam.