Jump to content

Php mail function (html email) not working for hotmail addresses


Calamity-Clare

Recommended Posts

I've been trying to write a php script that generates email to 2 different email accounts upon submission of a form. The first is sent to my client which sends him all the information that the user entered into the form. The second is a courtesy email thanking them for filling in the form.

 

The emails work well if I use straight php mail. However, I need to emails to look pretty so I added in headers to send it as html emails. I have it working for almost all email services, Mail for mac, outlook, gmail & the webmail account connected to the server that the website is on.

 

However, hotmail doesn't receive the emails once headers have been introduced into the mix. It's not that they are being routed to the junkmail folder (I had issues with that in the beginning), they just don't get there at all.

 

Does anyone know why this would be? I have referenced various websites to try to correct this, but none of the changes seem to help. This is my code so far:

$headers = "From: Options Trading Australia [email protected]" . "\r\n";
$headers .= "Reply-To: [email protected]" . "\r\n";
$headers .= "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1" . "\r\n";
  
// Email #1: Create the email body as a text message to Client
$to1 = [email protected];
$subject1 = "Newly submitted form";
$body1 = "Expression of interest in attending seminars from '$name'. <br /><br /> Seminar Attending: $month, <br /> Interest: $interest, <br /> Title: $title, <br /> Name: $name, <br /> Address (Line 1): $address1, <br /> Address (Line 2): $address2, <br /> Suburb/Town: $suburbtown, <br /> State: $state, <br /> Postcode: $postcode, <br /> Contact Number: $contactnumber, <br /> Email Address: $email, <br /> Number of Attendees: $numberattendees, <br /> Additional Queries or Comments: $additionalqueries.";
$message1 = "<html><body><img src=\http://www.optionstradingaustralia.com.au/header_email.jpg\ alt=\"\" width=\"1000\" height=\"162\" border=\"0\" /><p style=\"font-family:\"Myriad Pro\", \"Helvectica\", \"Arial\", \"Sans-serif\"; font-size:13px;\">$body1</p></body></html>";
  
// Email #2: Create the email body as a text message to Form User
$to2 = "$name <$email>";
$subject2 = "Thank you for your interest in Options Trading Australia's Seminars";
$body2 = "Thank you, $name for registering your interest in learning more about and attending our $month educational program. We will contact you shortly with further detailed information about the seminars. <br /><br /> Have a good day! <br /> Kind regards, <br /> Peter Dousek";
$message2 = "<html><body><img src=\'http://www.optionstradingaustralia.com.au/header_email.jpg\" alt=\"\" width=\"1000\" height=\"162\" border=\"0\" /><p style=\"font-family:\"Myriad Pro\", \"Helvectica\", \"Arial\", \"Sans-serif\"; font-size:13px;\">$body2<br /><br /></pre>******************** <br />This email (including all attachments) is the sole property of Options Trading Australia and may be confidential. If you are not the intended recipient, you must not use or forward the information contained in it. This message may not be reproduced or otherwise republished without the written consent of the sender. If you have received this message in error, please delete the e-mail and notify the sender.</pre></p></body></html>";
  
// Send the data in an email to Client
mail ($to1, $subject1, $message1, $headers);
// Send the data in an email to Form User
mail ($to2, $subject2, $message2, $headers);

 

I've attached my full script. I've got error reporting set on strict and I get no error messages when I submit the form. Any suggestions would be very helpful!

Thanks :)

 

[attachment deleted by admin]

Thanks Desmond! I tried that, but it didn't seem to work ... What does adding that do btw? I've never seen it used before?

 

(I'm presuming I'm applying it correctly, yes?:

mail ($to2, $subject2, $message2, $headers, "[email protected]");

)

Ok, if that's the right way then I added it to the second mail function only, since the first one has no risk in being sent to a hotmail address.

 

When you suggested it, I added it to the script, tested it in hotmail and nothing happened. I just then tried testing it with a gmail account & the resultant email came through, as it was doing before I added it. So unfortunately it hasn't solved anything yet

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.