james01302
BANNED
- Sep 13, 2022
- 27
- 4
I tried sending emails with this PHP script, but the 'From' header doesn't work (and I tried other scripts too, same problem). That is, emails arrive, but from my hosting's standard domain / email address, not the one I specified. Do you know if it's possible to change the code to have the email arrive from the email address I specified? For example, [email protected]
PHP:
<?php
$to = '[email protected]';
$subject = 'Subject';
$message = 'This is a test';
$headers = 'From: MyDomain <[email protected]>' . "\r\n" .
'Reply-To: [email protected]' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);
?>
Last edited: