Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

about PHP mailer 1

Status
Not open for further replies.

jebo100

Technical User
May 11, 2007
52
PH
i have made a simple message form in my page which will be mailed back into my email address from a visitor.

a line goes like this to send the mail:
mail('mymail@mydomain.com', 'my_subject','my_message');

all goes well and i recieved the mails in my email address except for the senders name.

my question is:
is there a way to change the mail sender name?
because when i recieve the mail it says that the sender is from generalmail@bravehost.com (i am using bravenet).

thanks ppl!
 
Code:
$from = "email@example.com";
$headers = "From: $from \r\nReply-to: $from\r\n";
mail('mymail@mydomain.com', 'my_subject','my_message', $headers);

 
i have tried that.
but $headers only shows on top of my mail message. the sender still says that its from generalmail@host.com

maybe somethings wrong with my php ini setup?
 
the headers will override your php.ini setting.

you must be doing something else wrong.

try using phpmailer
 
i tried this one,

$from = "email@example.com";
//omitted the $headers the line below
$headers = "From: $from \r\nReply-to: $from\r\n";

mail('mymail@mydomain.com', 'my_subject','my_message',"FROM: ". $from);

i just copied this in one of my php e-manual and it worked.
from you experince, would this be ok? or should i really need to use the $headers?

thanks much for the help.
 
you need the line terminators at the end. \r\n
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top