我不能发送电子邮件php到Hotmail?

时间:2014-10-20 11:38:00

标签: php sendmail hotmail

这是我的代码:

<?php

$to = 'test@hotmail.com';
$subject = 'reservation hotel n';
$msg ='ok';

// Make sure to escape quotes

$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=utf-8' . "\r\n";
$headers .= 'From:  hôtel  <reservation@hotel.com' . "\r\n";

mail($to, $subject, $msg, $headers);

?>

适用于Gmail,Yahoo,GMX ......但它对Hotmail / Live / MSN无效。

因为它适用于Gmail,我可以认为它与我的服务器无关,对吧?

我也试过它: http://www.microsoft.com/mscorp/safety/content/technologies/senderid/wizard/Default.aspx

系统维护正在进行中。请稍后再试。

想得到帮助

3 个答案:

答案 0 :(得分:0)

我认为你需要其中一个才能工作: Sender ID Framework SPF Record Wizard

它应该解决您的问题,因为Hotmail希望这是为了安全。

答案 1 :(得分:0)

Check it

<?php
   $to = "$email";
    $subject = "Welcome to";
    $message = " Hi $username,<br /><br />
    Thank you for signing up with us.<br />

    Thanks <br />";
    // Always set content-type when sending HTML email
    $headers = "MIME-Version: 1.0" . "\r\n";
    $headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";
    // More headers
    $headers .= 'From: <test@gmail.com>' . "\r\n";
    $mail=mail($to,$subject,$message,$headers);
?>

答案 2 :(得分:0)

问题解决了我用php邮件改变了

require_once "class.phpmailer.php"; 
require_once "class.smtp.php"; 



$mail->Host       = "smtp.gmail.com";  
$mail->Port       =  587;  
$mail->Username = "**@gmail.com";
$mail->Password = "**";
$mail->From       = "***";  

$mail->FromName   = "Hôtel **";  
$mail->IsHTML(true); // if you are going to send HTML formatted emails
$mail->SingleTo = true; // if you want to send a same email to multiple users. multiple emails will be sent one-by-one.

//Caractéristiques du message  
$mail->CharSet     = 'utf-8';  
$mail->ContentType = 'text/plain';  
$mail->Encoding    = '8bit';  

$mail->Subject    = "**";  
$mail->Body       = "okkk";  
$mail->WordWrap   = 0;  

$mail->AddAddress("**@hotmail.com", "nom");  
$mail->Send();