Jump to content


Photo

can't email hotmail account


  • Please log in to reply
8 replies to this topic

#1 boombanguk

boombanguk
  • New Members
  • Pip
  • Newbie
  • 8 posts

Posted 16 September 2006 - 09:12 PM

Hi,

I'm using..

$headers  = "MIME-Version: 1.0\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'From: CHWMFL <example@example.com>' . "\r\n";
$email = 'caberfeigh@hotmail.com';
$subject = "CHWMFL Scores Posted";

mail($email, $subject, $Message3,"From: CHWMFL <caberfeigh@hotmail.com>\n X-Mailer: PHP/" . phpversion());

to try to send an email to my hotmail account, but nothing is going through to it, not even to the junkmail. I've tested it with my other email (non hotmail) and it works fine. Any idea's what im doing wrong??

thanks for any advice.

#2 mainewoods

mainewoods
  • Members
  • PipPipPip
  • Advanced Member
  • 685 posts
  • LocationMaine

Posted 16 September 2006 - 09:16 PM

there are a number of user contributed notes on solving hotmail problems at the bottom of the php reference manual on mail()
http://us2.php.net/m...en/ref.mail.php

#3 boombanguk

boombanguk
  • New Members
  • Pip
  • Newbie
  • 8 posts

Posted 17 September 2006 - 01:18 AM

I've seen them, but they do not specifically apply to sending to hotmail.

Also I can't make head or tail of them!

I'm just looking for why my code won't work, or someone to provide some php code,that I'm told is 100% to work to send emails to hotmail accounts. That way if it doesn't work on my server at least I know its not the code thats the problem.

#4 tomfmason

tomfmason
  • Staff Alumni
  • Advanced Member
  • 1,696 posts
  • Locationstealing your wifi

Posted 17 September 2006 - 01:26 AM

I had a simular issue. I am not sure if this is the reason or not but I found that I am able to send email to hotmail email accounts with the following headers.


<?php
$to = "someone@something.com";
$subject = "Your subject";
$message ='<html>
<title>Hello this is a test message</title>
<body>
<table width="600" height="300" bgcolor="#999999">
  <tr>
     <td>Your message here</td>
  </tr>	 
</table>
</body>
</html>';
$knownsender = "you@yoursite.com"; //make sure this address in known to the server..
$headers = "FROM: $knownsender\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-type: multipart/alternative;\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "Content-Transfer-Encoding: 7bit";
$headers .= "\r\n";

if (mail($to, $subject, $message, $headers)) {
   echo "Your mail was sent to $to";
}else{
   echo "Unable to send the message";
}      
?>

Give this one a shot. Rember, you do not want the message table to wider then 600px.

Good Luck,
Tom

Traveling East in search of instruction, and West to propagate the knowledge I have had gained.

current projects: pokersource

My Blog | My Pastebin | PHP Validation class | Backtrack linux


#5 boombanguk

boombanguk
  • New Members
  • Pip
  • Newbie
  • 8 posts

Posted 17 September 2006 - 02:24 AM

thanks I'll try that, but ill have to convert it. Thats a html email? I'm after something even more basic then that, just a plain text will suffice. I'll try the headers though thanks.

#6 boombanguk

boombanguk
  • New Members
  • Pip
  • Newbie
  • 8 posts

Posted 17 September 2006 - 02:41 AM

thanks I'll try that, but ill have to convert it. Thats a html email? I'm after something even more basic then that, just a plain text will suffice. I'll try the headers though thanks.


ok i just tried this

mail($ToName." <".$myEmail.">",$ToSubject, $Message2, "From: ".$message3." <".$FromEmail.">");

$to = $ToEmail;
$subject = $ToSubject;
$knownsender = "boombanguk@lineone.net"; //make sure this address in known to the server..
$headers = "FROM: $knownsender\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-type: multipart/alternative;\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "Content-Transfer-Encoding: 7bit";
$headers .= "\r\n";

if (mail($to, $subject, $Message, $headers)) {
  echo "Your mail was sent to $to";
}else{
  echo "Unable to send the message";


and it didn't work. But the first mail, which is directed to send a cc to my boombanguk email worked fine. Just nothing went through to my caberfeigh@hotmail.com hotmail account. Any ideas?? is it because its a html email? when I just need a plain text?

and when you say "make sure this address in known to the server.." what do you mean by that? known by hotmail? or known to the server the php code is on?

#7 boombanguk

boombanguk
  • New Members
  • Pip
  • Newbie
  • 8 posts

Posted 17 September 2006 - 03:04 AM

just tried your code to send to a yahoo.com address and it worked fine, just won't go through to hotmail

#8 tomfmason

tomfmason
  • Staff Alumni
  • Advanced Member
  • 1,696 posts
  • Locationstealing your wifi

Posted 17 September 2006 - 03:12 AM

I don't know what the problem is. It works just fine for me. Maybe someone else has a little more knowledge about this.

Good Luck,
Tom

Traveling East in search of instruction, and West to propagate the knowledge I have had gained.

current projects: pokersource

My Blog | My Pastebin | PHP Validation class | Backtrack linux


#9 CanMan2004

CanMan2004
  • Members
  • PipPipPip
  • Advanced Member
  • 254 posts

Posted 17 September 2006 - 01:40 PM

I did experience the same issue some time ago and it ended up being some settings on the server which blocked hotmail type emails from going out or in via php forms, explain the issue to the hosting company and they maybe able to assist you.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users