Jump to content

mail function header issue


punjabi

Recommended Posts

hi,

im using the mail function as follows

$to = $email;

$subject = "Welcome";

$mailmessage = "blah";

                                                $headers = "From:mysite.com";

mail($to, $subject, $mailmessage, $headers);

 

The problem is that in the sent mail the from header shows up as :[email protected]

How do I get rid of the hosting company stuff?

Link to comment
https://forums.phpfreaks.com/topic/116130-mail-function-header-issue/
Share on other sites

you need to have "\r\n";

 

<?php
$to      = '[email protected]';
$subject = 'the subject';
$message = 'hello';
$headers = 'From: [email protected]' . "\r\n" .
    'Reply-To: [email protected]' . "\r\n" .
    'X-Mailer: PHP/' . phpversion();

mail($to, $subject, $message, $headers);
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.