Question
PHP email is sending from different address than specified
Hi Forum,
My script is sending email but the email address is not the one I'm specifying on the script below. Instead a "www-data@mrd.axai.mx" is the sender (which I believe is the default for my server)
Any ideas? Thank you
function SendMail($MailBody,$ToMail)
{
$IsSend='False';
try
{
$to = $ToMail;//"erik.nuno@gmail.com";
$subject = "LockLizard PDF Viewer license Information form montessoripdf.com";
$from = "design@montessorird.com"; // Insert From Mail
$headers = 'Content-type: text/html; charset=iso-8859-1' . "\r
"; $headers .= "From:" . $from; ini_set( "sendmail_from", "design@montessorird.com" );// Insert From Mail ini_set( "SMTP", "montessorird.ipower.com" ); ini_set( "smtp_port", "25" ); ini_set("username","design@montessorird.com"); // Insert From Mail ini_set("password","xxxxx");// Insert From Mail Password mail($to,$subject,$MailBody,$headers); $IsSend='True'; } catch(exception $ex) { $IsSend='False'; echo 'Caught exception: ', $ex->getMessage(), "
"; } return $IsSend; }
"; $headers .= "From:" . $from; ini_set( "sendmail_from", "design@montessorird.com" );// Insert From Mail ini_set( "SMTP", "montessorird.ipower.com" ); ini_set( "smtp_port", "25" ); ini_set("username","design@montessorird.com"); // Insert From Mail ini_set("password","xxxxx");// Insert From Mail Password mail($to,$subject,$MailBody,$headers); $IsSend='True'; } catch(exception $ex) { $IsSend='False'; echo 'Caught exception: ', $ex->getMessage(), "
"; } return $IsSend; }
Add a comment
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
×