By design148961
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<br/>”;
$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(), “<br/>”;
}
return $IsSend;
}
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Awesome! :D <br> <br>Basically, you need to terminate each header with <code>\r\n</code> instead of <code>\r</code>. I’ve also changed a few bits of your code to make it cleaner and easier to read.
Dear Kamal, YOU ROCK!!! <br> <br>Thank you so much that did it, I have been struggling with this for so long I have no words to really thank you for this :)
Try replacing <pre>$headers = ‘Content-type: text/html; charset=iso-8859-1’ . “\r <br>”; <br>$headers .= “From:” . $from; </pre> with <pre>$headers = “Content-Type: text/html; charset=iso-8859-1\r\n”; <br>$headers .= “From: {$from}”; </pre>
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.