Jump to content

does php mail works with hotmail?


ted_chou12

Recommended Posts

Hello, this is my code:
[code]
<?php
$to = "[email protected]";

$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??
Link to comment
https://forums.phpfreaks.com/topic/31517-does-php-mail-works-with-hotmail/
Share on other sites

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.
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.

Regards
Huggie
Okay, I had added in option headers:
[code]
<?php
$to = "[email protected]";
$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<[email protected]>rn";
$headers .= "Return-Path: <[email protected]>";

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?
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?
I achieved it with the minimum of headers...

[code]<?php
// Email details
$to = "[email protected]";
$from = "[email protected]";
$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 mail
if (mail($to, $subject, $body, $headers)){
  echo "Success\n";
}
else {
  echo "Failed\n";
}[/code]

Regards
Huggie

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.