2014-09-17 3 views
2

PHPMailer를 사용하여 웹 사이트에서 자동 이메일을 보내고 테스트하는 동안 Gmail 웹 사이트에서 메일을 보내면 PHP 메일러에서 보낸 전자 메일이 받는 사람에 대한 경고 다음 끝 : 이 메시지는 보낸 사람이 아닙니다. [email protected] 자세한 내용 피싱 신고. 그러나 다른 전자 메일 (예 : Outlook)을 사용하면 내 $contact_email에 전자 메일이 없습니다. 이 문제를 해결하도록 도와주세요.PHP 메일로 Gmail에 피싱 경고가 발생했습니다.

PHP 메일러 코드 :

<?php 
global $_REQUEST; 
$response = array('error'=>''); 

    $user_name = substr($_REQUEST['user_name'], 0, 20); 
    $user_email = substr($_REQUEST['user_email'], 0, 40); 
    $user_msg = $_REQUEST['user_msg']; 

    $contact_email = '[email protected]';  

    if (trim($contact_email)!='') { 
     $subj = 'Message from Official Website'; 
     $msg = "Name: $user_name 
     E-mail: $user_email 
     Message: $user_msg"; 

     $head = "Content-Type: text/plain; charset=\"utf-8\"\n" 
      . "X-Mailer: PHP/" . phpversion() . "\n" 
      . "Reply-To: $user_email\n" 
      . "To: $contact_email\n" 
      . "From: $user_email\n"; 

     if ([email protected]($contact_email, $subj, $msg, $head)) { 
      $response['error'] = 'Error send message!'; 
     } 
    } else 
      $response['error'] = 'Error send message!'; 

    echo json_encode($response); 
    die(); 

?> 
+3

이것은 PHPMailer와는 아무런 관련이 없습니다. PHP의'mail()'함수를 사용하고 있습니다 ... –

답변

1

당신도 귀하의 사이트에 대한 Google 앱을 설정하고 [email protected]의 Gmail 계정 (더 많은 정보 : http://www.google.com/enterprise/apps/business/)를 얻을 수있다, 또는 당신은을 설정해야합니다 현재 서버의 전자 메일 주소 ([email protected])를 $ mail-> from 주소로 사용하십시오.

Google에서 사용자의 서버에서 전자 메일을 보내라고 말하면 전자 메일받는 사람에게 메시지가 도착한 다음 해당 전자 메일이 gmail에서 왔음을 알리고 있습니다. 귀하의 개인 서버에서. 보낸 사람 주소와 서버 주소가 일치하지 않으므로 스팸으로 신고합니다. 이것은 스팸을 막는 googles 방법입니다. $ mail-> from ([email protected])을 입력하면 스팸을 차단하는 방법이 동일합니다. 전자 메일은 계속 전송되지만 도메인 이름은 @ 주소와 일치하지 않습니다.

0

코드를 사용해보십시오. 코드에서 제가 여기서 풀어 낸 실수를 발견했습니다.

global $_REQUEST; 
    $response = array('error'=>''); 

     $user_name = substr($_REQUEST['user_name'], 0, 20); 
     $user_email = substr($_REQUEST['user_email'], 0, 40); 
     $user_msg = $_REQUEST['user_msg']; 

     $contact_email = '[email protected]'; 

     if (trim($contact_email)!='') { 
      $subj = 'Message from Official Website'; 
      $msg = "Name: $user_name 
      E-mail: $user_email 
      Message: $user_msg"; 

      $head = "Content-Type: text/plain; charset=\"utf-8\"\n" 
       . "X-Mailer: PHP/" . phpversion() . "\n" 
       . "Reply-To: $user_email\n" 
       . "To: $contact_email\n" 
       . "From: $user_email\n"; 

      if ([email protected]($contact_email, $subj, $msg, $head)) { 
       $response['error'] = 'Error send message!'; 
      }else{ 
       $response['error'] = 'success!'; 
      } 
     } else { 
     $response['error'] = 'Error send message!'; 
     } 
     echo json_encode($response); die(); 
1

당신은 대량 이메일을 보낼 때 당신이 보낸 사람 주소를 조롱 할 때 특히, 당신은 스패머로를 차단 얼마나 많은 서버 줄일 수 있습니다 모범 사례를 사용해야합니다. 나는 당신이해야한다고 생각

세 가지가 있습니다 :

1) 추가 적절한 메일 헤더

을 사용하여 코드에 다음과 같은 -이이 OPT-OUT의 이메일이 대량 발송은, 그 통지 주소 :

.= "X-mailer: YOUR_SITE_DOMAIN Server" . "\r\n"; // this will identify the real sender 
.= "Precedence: bulk" . "\r\n"; // this will say it is bulk sender 
.= "List-Unsubscribe:[email protected]_SITE_DOMAIN\r\n"; // this will reveal the OPT-OUT address 

here

2) 서버 도메인이 역 DNS 기록이 있는지 확인에 대해 자세히 알아보십시오. 이렇게하면받는 사람의 서버가 귀하의 도메인이 귀하의 서버에서 실제로 호스팅되고 있음을 알 수 있습니다.

3) 도메인에 SPF 레코드를 게시하십시오. 당신은 그것에 대해 더 많은 것을 읽을 수 있습니다 here, 그리고 야후와 같은 다른 큰 핸들러를 위해 google.

그 외에도 "한 번 클릭"OPT-OUT 제거 옵션이있는 바닥 글을 추가했는지 확인하고이 메시지가 대신 발신되며 원래 보낸 사람인지 확인하십시오.

건배

관련 문제