Changing the sender in the mail() function

A

Anonymous

Guest
the from address is defined in the header. example

Code:
$fromName = "from"; 
$fromEmail = "from@metoyou.com"; 

$toName = "recipient"; 
$toEmail = "to@metoyou.com"; 

$message = "This is a test"; 
$subject = "testing email"; 

$headers = "From: ".$fromName." <".$fromEmail.">\r\n"; 

mail($toEmail, $subject, $message, $headers);
 
Back
Top