Advertisement

07.02.2008 at 12:19AM PDT, ID: 23532697
[x]
Attachment Details

Cannot send mails via PHP to Hotmail

Asked by fraW in Simple Mail Transfer Protocol (SMTP), PHP and Databases

Tags: PHP

It seems like i cannot send any mails to hotmail addresses with PHP however with the same e-mail im sending from, from outlook, it works. Though im using another ISP when using outlook, might this be a problem?
The mails are moved directly to the junkmail when i send via PHP. The code is attatched.Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
<?php
 
  $Message              = 'Hej kompis,' . PHP_EOL . PHP_EOL;
  $Message             .= 'Är allr bra med dig?' . PHP_EOL;
  $Message             .= 'MVH';
 
  $Subject              = "Ey, a message goes here!";
  $FromDomainName       = "mydomain.se";
  $FromUser             = "info";
  $XMailerName          = "Private Mailer";
  $ToEmailAddress       = "myMail@hotmail.com";
  $FromEmailAddress     = "$FromUser@$FromDomainName";
 
  $PriorityLevelNumeric = "1";
  $PriorityLevelAlpha   = "High";
  $MimeVersion          = "1.0";
 
  $MessageId            = date('YmdHis')."@$FromDomainName";
  $RFC2822              = date('r');
 
  $Headers              = "X-Sender: $ToEmailAddress\r\n";
  $Headers             .= "From: $FromEmailAddress\r\n";
  $Headers             .= "Reply-To: $FromEmailAddress\r\n";
  $Headers             .= "Date: $RFC2822\r\n";
  $Headers             .= "Message-ID: <$MessageId>\r\n";
  $Headers             .= "Subject: $Subject\r\n";
  $Headers             .= "Return-Path: $FromEmailAddress <$FromEmailAddress>\r\n";
  $Headers             .= "Delivered-to: $FromEmailAddress\r\n";
  $Headers             .= "MIME-Version: $MimeVersion\r\n";
  $Headers             .= "Content-Type: text/html; charset=iso-8859-1\r\n";
  $Headers             .= "Content-Transfer-Encoding: 8bit\r\n";
  $Headers             .= "X-Priority: $PriorityLevelNumeric\r\n";
  $Headers             .= "Importance: $PriorityLevelAlpha\r\n";
  $Headers             .= "X-MSMail-Priority: $PriorityLevelAlpha\r\n";
  $Headers             .= "X-Mailer: $XMailerName\r\n\r\n";
 
  $SendMail             = mail($ToEmailAddress,$Subject,$Message,$Headers);
 
  echo 'Mail: ' . $SendMail . PHP_EOL;
 
?>
[+][-]07.02.2008 at 02:30AM PDT, ID: 21914635

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Simple Mail Transfer Protocol (SMTP), PHP and Databases
Tags: PHP
Sign Up Now!
Solution Provided By: mms_master
Participating Experts: 1
Solution Grade: A
 
 
[+][-]07.02.2008 at 02:38AM PDT, ID: 21914667

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628