2012-12-15 3 views
1

가능한 중복 :
Mail not being received by hotmail.comPHP 메일을받지 못하셨습니까?

나는 내 사이트에이 간단한 양식을하고 심지어 정크 폴더, 내 Hotmail 계정에 보낼 때 나는 이메일을 수신하지 않습니다.

<form action="mail.php" method="POST"> 
    <p><label title="Name">Name:</label><br /> 
     <input type="text" name="name" autocomplete="on" required="required"></p> 
    <p><label title="Email">Email:</label><br /> 
     <input type="text" name="email" autocomplete="on" required="required"></p> 
    <p><label title="About">My message is about...</label><br /> 
     <select name="about"> 
      <option value="general">General Query</option> 
      <option value="wedding">Wedding</option> 
      <option value="corporate">Corporate Event or Trade Show</option> 
      <option value="other">Other Event</option> 
     </select> 
    <p><label title="Message">Message:</label><br /> 
     <textarea name="message" rows="6" cols="25" required="required"></textarea></p> 
    <input type="submit" value="Send"> 
</form> 

그리고 mail.php 파일 : 여기

양식 코드입니다! "감사"나는이있는 페이지를보고 끝내는

<?php 
     $name = $_POST['name']; 
     $email = $_POST['email']; 
     $message = $_POST['message']; 
     $about = $_POST['about']; 
     $formcontent="From: $name \n About: $about \n Message: $message"; 
     $recipient = "[email protected]"; 
     $subject = "Contact Form"; 
     $mailheader = "Reply-To: $email \r\n"; 
    mail($recipient, $subject, $formcontent, $mailheader) or die("Error!"); 
    echo "Thank You!"; 
?> 

표시된 이메일은 수신되지 않습니다.

+1

로그를 확인하십시오. 로그를 확인하십시오. 그런 다음 메일이 발송되는지 여부를 알려주십시오. 그리고 아니요, 메일을 받았는지 여부는 알 수 없습니다. 이 사이트의 기존 Q & A 자료에서 해당 정보를 쉽게 파악할 수 있습니다. 또한 : http://php.net/mail은 * 반환 값 *을 가지고 있습니다. 문제 해결의 용이함. – hakre

+0

왜 SMTP 서비스를 사용하지 않습니까? –

답변

3

메일 배달은 까다로운 사업입니다 ... 메일을 보내신 것만으로는 누구나받을 수있는 것은 아닙니다. 많은 수신 서버가 특정 기준을 충족하지 않는 경우 들어오는 메시지를 무시합니다 (Gmail 및 Hotmail은 특히 메시지 전달을 자동으로 거부하는 경향이있어 스팸으로 끝나지 않습니다).

1) 당신은

2) 당신이하지 않은 것을 확인 DNS 레코드에 PTR/SPF (역방향 조회) 항목을 설정 한 : 당신이 완료했는지 확인하기 위해 몇 가지가있다 당신이 정말로 메일 via SMTP을 보내 메일이 통과 할 수 있도록하려면 어떤 블랙리스트 (http://www.mxtoolbox.com/blacklists.aspx)

3), 그러나 당신의 헤더

$headers = "MIME-Version: 1.0\r\n" 
      ."Content-Type: $contentType; charset=utf-8\r\n" 
      ."Content-Transfer-Encoding: 8bit\r\n" 
      ."From: =?UTF-8?B?". base64_encode("Your sending display name") ."?= <$from>\r\n" 
      ."Reply-To: $replyTo\r\n" 
      ."X-Mailer: PHP/". phpversion(); 

를 확장합니다. 메일 배달을 보장 할 수는 없지만 훨씬 더 신뢰할 수 있습니다. 많은 양의 메일을 보내지 않으면 Mandrill 또는 유사한 서비스를 사용하여 이메일을 릴레이 해보십시오.

0

다음과 같은 방법을 사용할 수 있습니다. 성공하면 true를 반환합니다.

function sendMail($email, $subject, $message) 
{ 
    $supportEmail = '[email protected]'; 
    $from = 'Abc'; 
    $msg = $message; 
    $from = str_replace(' ', '-', $from); 
    $frm = $from.' <'.$supportEmail.'>'; 
    preg_match("<(.*)@(.*\..*)>", $frm, $match); 

    ///////////////////Headers///////////////// 
    $hdr=''; 
    $hdr.='MIME-Version: 1.0'."\n"; 
    $hdr.='content-type: text/html; charset=iso-8859-1'."\n"; 
    $hdr.="From: {$frm}\n"; 
    $hdr.="Reply-To: {$frm}\n"; 
    $hdr.="Message-ID: <".time()."@{$match[2]}>\n"; 
    $hdr.='X-Mailer: PHP v'.phpversion(); 
    [email protected]($email, $subject, $msg, $hdr); 
    if($x==0) 
    { 
     $email=str_replace('@','\@', $email); 
     $hdr=str_replace('@','\@',$hdr); 
     [email protected]($email, $subject, $msg, $hdr); 
    } 
    return $x; 
} 
관련 문제