I am trying to send email from my php :
$to = '[email protected]';
$email_from = "[email protected]";
$full_name = 'Suraj Hazarika';
$from_mail = $full_name.'<'.$email_from.'>';
$subject = "testing sender name";
$message = "";
$message .= '
<p><strong>This is only a test . Please do not reply.</strong><br />
';
$from = $from_mail;
$headers = "" .
"Reply-To:" . $from . "\r\n" .
"X-Mailer: PHP/" . phpversion();
$headers .= 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
mail($to,$subject,$message,$headers);
I am following the tutorial PHP E-mail Form Sender Name Instead Of E-mail? but I am still getting the emails with sender name with hostname.
From Date Subject
[email protected] Fri, 11:24 pm testing sender name
[email protected] Fri, 11:24 pm testing sender name
I came to this question looking for something different but with similar words, so here's how to do what I was looking for:
In the from
header, put the address in angle brackets, and the "sender name" outside of it.
from: Don Draper <[email protected]>\n
I wanted the inbox to say Don Draper
instead of don.draper
and that's how to do it.