Page 1 of 1
How can I Mail from
Posted: Tue Feb 23, 2010 6:13 am
by mariolopes
Hi
I want to email a message but how can i define the sender of the message. I use the following command
Re: How can I Mail from
Posted: Tue Feb 23, 2010 6:16 am
by pbs
Use headers
Code: Select all
mail($to, $subject, $message, $headers);
Also refer
http://php.net/manual/en/function.mail.php
Re: How can I Mail from
Posted: Tue Feb 23, 2010 6:29 am
by Apollo
Adding the -f flag will do the trick:
Code: Select all
$from = "your.address@somewhere.com";
$to = "yourmomma@hotmail.com";
$subject = "Hello";
$body = "Hi mum, how are you?";
$header = "From: $from\r\n";
$flag = "-f$fromAddress";
mail($to,$subject,$body,$header,$flag);
Re: How can I Mail from
Posted: Tue Feb 23, 2010 6:37 am
by mariolopes
works perfect
Thank you guys