Display users email in from field

the mail() function

Moderators: egami, macek, gesf

Post Reply
rupali
New php-forum User
New php-forum User
Posts: 140
Joined: Thu Oct 13, 2011 10:32 pm
Location: Chandigarh, INDIA

Fri Mar 09, 2012 6:35 pm

hello,
you have missed the header section in the mail function, where we can mention the sender's email id
so add these lines to your code :

$headers = 'From: <sender's email id>' . "\r\n" .
'X-Mailer: PHP/' . phpversion();

and also mention this variable in the mail function as :
mail($MAIL_TO, $subject, $body, $headers);

Post Reply
  • Information
  • Who is online

    Users browsing this forum: No registered users and 2 guests