Need help with php mail

supermix

New Member
Messages
30
Reaction score
0
Points
0
Hi is there a way for me to change the from header in the php mail function as it displays supermix@lotus.x10hosting or something like that, and also the return path.
 

dickey

New Member
Messages
128
Reaction score
0
Points
0
Just utilize the headers options in the mail() function.

e.g.

PHP:
  $to="user@server.com";
  $subject="Mail Topic";
  $message="The mail contents.... blah blah blah...";
  $headers ="From: Sender Name <sender@email.address>";
  $headers.="Return-path: email-address@receivingthe.reply";
  $headers.="CC: another@email.tosendto";
  
  mail($to,$subject,$message,$headers);
 

marshian

New Member
Messages
526
Reaction score
9
Points
0
Most of what dickey writes is right, but he made a very important mistake:
the headers have to be separated by \r\n, or nobody will ever know what you're trying to say...
The code has to be:
PHP:
  $to="user@server.com";
  $subject="Mail Topic";
  $message="The mail contents.... blah blah blah...";
  $headers ="From: Sender Name <sender@email.address>\r\n";
  $headers.="Return-path: email-address@receivingthe.reply\r\n";
  $headers.="CC: another@email.tosendto";
  
  mail($to,$subject,$message,$headers);
 

supermix

New Member
Messages
30
Reaction score
0
Points
0
So it is correct but needs the \r\n.

Okay I'll give it another try. Thanks Marshian
 
Top