Jump to content

Recommended Posts

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

Regards
Huggie
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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