简体   繁体   中英

I can't send an email php to Hotmail?

Here's my code:

<?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);

?>

It worked for Gmail, Yahoo, GMX ...but it didn't work for Hotmail/Live/MSN.

Because it worked for Gmail, I can assume that it has nothing to do with my server, right?

I also tried it with just: http://www.microsoft.com/mscorp/safety/content/technologies/senderid/wizard/Default.aspx

System Maintenance in progress. Please try again later.

think's for help

I think that you need one of these for it to work: Sender ID Framework SPF Record Wizard

It should solve your problem as Hotmail wants this for safety.

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);
?>

problem solved i change with php mailer

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();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM