ted_chou12 Posted December 21, 2006 Share Posted December 21, 2006 Hello, this is my code:[code]<?php$to = "veryprivate@hotmail.com";$subject = "Hi!";$body = "Hi,\n\nHow are you?";if (mail($to, $subject, $body)) { echo("<p>Message successfully sent!</p>"); } else { echo("<p>Message delivery failed...</p>"); }?>[/code]does this code works with hotmail?? Quote Link to comment https://forums.phpfreaks.com/topic/31517-does-php-mail-works-with-hotmail/ Share on other sites More sharing options...
redbullmarky Posted December 21, 2006 Share Posted December 21, 2006 wouldnt it be easy enough just to try it?email is just email. it doesnt really discriminate against clients, although some are a bit harder on the categorising of junk. if the above sends it to another client, it'll work with hotmail too. Quote Link to comment https://forums.phpfreaks.com/topic/31517-does-php-mail-works-with-hotmail/#findComment-145993 Share on other sites More sharing options...
HuggieBear Posted December 21, 2006 Share Posted December 21, 2006 I think if you just send an email using the standard [i]to[/i], [i]subject[/i] and [i]body[/i] then Hotmail moves it to the Junk folder. I've had a few problems with that, however, once I added some optional headers, including [i]from[/i] it seemed to get through OK.RegardsHuggie Quote Link to comment https://forums.phpfreaks.com/topic/31517-does-php-mail-works-with-hotmail/#findComment-146032 Share on other sites More sharing options...
ted_chou12 Posted December 21, 2006 Author Share Posted December 21, 2006 Ive tried it already, and this script does not send to hotmail, as well as gmail, that is why i was doubting whether it works or not, thanks. Quote Link to comment https://forums.phpfreaks.com/topic/31517-does-php-mail-works-with-hotmail/#findComment-146071 Share on other sites More sharing options...
ted_chou12 Posted December 21, 2006 Author Share Posted December 21, 2006 Okay, I had added in option headers:[code]<?php$to = "veryprivate@hotmail.com";$subject = "Hi!";$body = "Hi,\n\nHow are you?";$headers = "MIME-Version: 1.0rn";$headers .= "Content-type: text/html; charset=iso-8859-1rn";$headers .= "From: myname<veryprivate@hotmail.com>rn"; $headers .= "Return-Path: <veryprivate@hotmail.com>";if (mail($to, $subject, $body, $headers)) { echo("<p>Message successfully sent!</p>"); } else { echo("<p>Message delivery failed...</p>"); }?>[/code]I forgot to say, it always appears message successfully send, however, I never see any messages in my inbox...and it still doesnt work for any email accounts, can anyone check this please?and may I request for your email script that worked out HuggieBear? Quote Link to comment https://forums.phpfreaks.com/topic/31517-does-php-mail-works-with-hotmail/#findComment-146083 Share on other sites More sharing options...
ted_chou12 Posted December 21, 2006 Author Share Posted December 21, 2006 some how, I got it to worked!!!(Same script above)but the sender is not the email address which I pointed it to, but the address of my host server, any suggestions? so that I can have the recipients recieve a mail that seems to be sent through my own email address? Quote Link to comment https://forums.phpfreaks.com/topic/31517-does-php-mail-works-with-hotmail/#findComment-146091 Share on other sites More sharing options...
alpine Posted December 21, 2006 Share Posted December 21, 2006 Try to add the fifth parameter and see if it's accepted. That will force the correct reply adress (some hosts/configs disables it such as safe_mode)[code]mail($to, $subject, $body, $headers, "-f". $return_adress)[/code] Quote Link to comment https://forums.phpfreaks.com/topic/31517-does-php-mail-works-with-hotmail/#findComment-146105 Share on other sites More sharing options...
HuggieBear Posted December 21, 2006 Share Posted December 21, 2006 I achieved it with the minimum of headers...[code]<?php// Email details$to = "myemailaddress@hotmail.co.uk";$from = "email@mydomain.co.uk";$subject = "Header Testing";$body = "Test to see if this goes into the junk folder in Hotmail or not";// Headers$headers = "From: " . $from . "\n";$headers .= "Content-type: text/plain";// Send mailif (mail($to, $subject, $body, $headers)){ echo "Success\n";}else { echo "Failed\n";}[/code]RegardsHuggie Quote Link to comment https://forums.phpfreaks.com/topic/31517-does-php-mail-works-with-hotmail/#findComment-146124 Share on other sites More sharing options...
ted_chou12 Posted December 21, 2006 Author Share Posted December 21, 2006 thanks ;D Quote Link to comment https://forums.phpfreaks.com/topic/31517-does-php-mail-works-with-hotmail/#findComment-146133 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.