Reputation: 1037
Hello I'm using PHP built in php mail() and using this function s=to send emails :
function sendEmail($to,$subject,$message){
$header = 'From: [email protected]' . "\r\n" .
'MIME-Version: 1.0' . "\r\n" .
'Content-type: text/html' . "\r\n" ;
$retval = mail ($to,$subject,$message,$header);
if( $retval == true ){
return true;
}
else{
return false;
}
}
This function is sending emails but I do receive them not from the "From email" header I set : "[email protected]" but from my host server like this : [email protected]
Why this is not working as I want?
Thanks
Upvotes: 1
Views: 138
Reputation: 1610
You want to use a properly formatted "From" statement as follows:
$header = 'From: <[email protected]>' . "\r\n" .
or
$header = 'From: "no reply" <[email protected]>' . "\r\n" .
and another possible approach could be this: problem with php mail 'From' header
Upvotes: 1