So I want the from
field when an email is opened to be something like
"Jack Sparrow Via somesite"
as opposed to an explicit email address.
I wondering how to set this in PHP's mail()
function?
You can accomplish this by using basic headers.
<?php
$to = '[email protected]';
$subject = 'the subject';
$message = 'hello';
$headers = 'From: Jack Sparrow <[email protected]>' . PHP_EOL .
'Reply-To: Jack Sparrow <[email protected]>' . PHP_EOL .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);
?>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With