2014-12-29 2 views
1

현재 우분투 14.04.1을 실행 중입니다. mail()을 사용하여 테스트 이메일을 보내고 Firefox에서 스크립트에 액세스하는 간단한 PHP 스크립트를 만들었습니다. 단일 IP 및 도메인이없는 VPS 서버가 있습니다. 이메일을 보내려고 할 때마다 Google DNS에서 오류를 수신합니다. 필자는 필요한 파일이라고 생각되는 일부 파일의 결과를 포함 시켰습니다.문제점 Linux 서버에서 메일 보내기

내가 사용하는 mail()은 mail("[email protected]", "test", "test");입니다. 나는 머리말 정보 및 더 정교한 주제 및 몸 정보를 추가하는 것을 시도했다, 그러나 그것은 돕지 않았다.

/var/log/mail.log

Dec 28 22:53:04 localhost sendmail[15365]: sBT3r4qG015365: from=www-data, size=83, class=0, nrcpts=1, msgid=<[email protected]>, [email protected] 
Dec 28 22:53:05 localhost sm-mta[15366]: sBT3r4F1015366: from=<[email protected]>, size=370, class=0, nrcpts=1, msgid=<[email protected]>, proto=ESMTP, daemon=MTA-v4, relay=localhost.localdomain [127.0.0.1] 
Dec 28 22:53:05 localhost sendmail[15365]: sBT3r4qG015365: to[email protected], ctladdr=www-data (33/33), delay=00:00:01, xdelay=00:00:01, mailer=relay, pri=30083, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (sBT3r4F1015366 Message accepted for delivery) 
Dec 28 22:53:05 localhost sm-mta[15368]: STARTTLS=client, relay=gmail-smtp-in.l.google.com., version=TLSv1/SSLv3, verify=FAIL, cipher=ECDHE-RSA-AES128-GCM-SHA256, bits=128/128 
Dec 28 22:53:06 localhost sm-mta[15368]: sBT3r4F1015366: to=<[email protected]>, ctladdr=<[email protected]> (33/33), delay=00:00:01, xdelay=00:00:01, mailer=esmtp, pri=120370, relay=gmail-smtp-in.l.google.com. [IPv6:2607:f8b0:400e:c04::1b], dsn=5.0.0, stat=Service unavailable 
Dec 28 22:53:06 localhost sm-mta[15368]: sBT3r4F1015366: sBT3r6F1015368: DSN: Service unavailable 
Dec 28 22:53:06 localhost sm-mta[15368]: sBT3r6F1015368: to=<[email protected]>, delay=00:00:00, xdelay=00:00:00, mailer=local, pri=30000, dsn=2.0.0, stat=Sent 
(email above has been changed to [email protected]) 

nameserver 8.8.8.8 
nameserver 8.8.4.4 
/etc/resolv.conf 파일

/etc/hosts 파일

ff02::1  ip6-allnodes 
ff02::2  ip6-allrouters 

127.0.0.1 localhost.localdomain localhost servername 
# Auto-generated hostname. Please do not remove this comment. 
x.x.x.x servername 
::1  localhost ip6-localhost ip6-loopback 
127.0.0.2 servername 
(servername and ip above have been changed to x.x.x.x and servername) 

/var/spool/mail/www-data

하나의 이메일을 보내려고하면 약 70 줄이 생기므로 생각보다 중요하다고 생각합니다. 영구적 인 치명적인 오류가 발생합니다.

550-5.7.1 
Our system has detected that this 
message is likely unsolicited mail. To reduce the amount of spam sent 
to Gmail, this message has been blocked. 

나는 시도했다 :

나는 PHP 스크립트에 액세스하는 데 사용하고 로딩을 중지 페이지 30 초 정도 걸릴 것이라고 나는 /var/log/mail.log에 다음과 같은 오류가 나타날 것입니다 :

Dec 29 00:35:55 localhost sendmail[15632]: My unqualified host name (servername) unknown; sleeping for retry 
Dec 29 00:36:55 localhost sendmail[15632]: unable to qualify my own domain name (servername) -- using short name 

이 문제를 해결하기 위해 127.0.0.1 라인을 /etc/hosts 라인으로 변경했습니다. 해당 줄을 현재 버전의 짧은 버전으로 변경하면 위의 오류 메시지와 PHP 스크립트가로드 될 수 있습니다.

메일을 보낼 때 다른 오류 메시지가 나타납니다. 문제를 찾아서 해결하기 위해 하단에 127.0.0.2 행을 추가했습니다. 더 이상 해당 줄을 제거하여 오류 메시지를 복제 할 수 없어서 그 줄이 더 이상 용도를 제공하지 않습니다.

나는 /var/log/mail.logDSN: Service unavailable에보고 시도했지만, 내가 찾은 모든 도움이되지 않았다 /etc/hosts/etc/hostname의 내용을 변경했다.

SPF 레코드에 대한 기사를 많이 읽었습니다. 이것은 공헌 할 수있는 것처럼 보입니다. 문제는 모든 문서에서 도메인을 IP에 연결하는 것에 대해 언급하는 것입니다. 도메인이 없으므로 이것이 중요한지 확실하지 않습니다. 그들은 또한 편집 /var/named/data/에 대해서 이야기하지만, /var/named은 나를 위해 존재하지 않습니다. 나는 내 컴퓨터에 내 nslookup 내 IP 주소를 시도하면, 그 오류가 Non-existent domain 얻을 것을 확인할 수 있습니다. 이는 /var/spool/mail/www-data의 오류와 관련이있을 수도 있습니다.

본인의 IP가 블랙리스트에 올라 있는지 보았지만 실제로는 그렇지 않습니다. 나는 최근 IP를 받았고 공유 IP가 아니기 때문에 이것이 문제가 아니라고 생각합니다.아이러니하게도, 이메일 수신을 시도하는 동안 스팸 폴더에 2 개의 메시지를 받았습니다. 더 이상 스팸으로 수신하지도 않습니다. 다음은 그러한 이메일 중 하나입니다.

Delivered-To: [email protected] 
Received: by 10.112.202.37 with SMTP id kf5csp1654885lbc; 
    Tue, 23 Dec 2014 20:55:39 -0800 (PST) 
X-Received: by 10.68.200.68 with SMTP id jq4mr50110283pbc.30.1419396938944; 
    Tue, 23 Dec 2014 20:55:38 -0800 (PST) 
Return-Path: <[email protected]> 
Received: from servername ([x.x.x.x]) 
    by mx.google.com with ESMTPS id td7si16741093pab.130.2014.12.23.20.55.38 
    for <[email protected]> 
    (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); 
    Tue, 23 Dec 2014 20:55:38 -0800 (PST) 
Received-SPF: temperror (google.com: error in processing during lookup of [email protected]: DNS timeout) client-ip=x.x.x.x; 
Authentication-Results: mx.google.com; 
    spf=temperror (google.com: error in processing during lookup of [email protected]:  DNS timeout) [email protected] 
Received: from servername (localhost.localdomain [127.0.0.1]) 
by brauer (8.14.4/8.14.4/Debian-4.1ubuntu1) with ESMTP id sBO4sYfV000877 
for <[email protected]>; Tue, 23 Dec 2014 23:54:34 -0500 
Received: (from [email protected]) 
by servername (8.14.4/8.14.4/Submit) id sBO4sYgK000874; 
Tue, 23 Dec 2014 23:54:34 -0500 
Date: Tue, 23 Dec 2014 23:54:34 -0500 
From: www-data <[email protected]> 
Message-Id: <[email protected]> 
To: [email protected] 
Subject: test 
X-PHP-Originating-Script: 0:file.php 


test 

죄송합니다. 너무 많은 정보가 포함되어있는 경우 죄송합니다. 나는 모두가 관련이 있는지 잘 모르겠습니다. 어떤 도움을 주시면 감사하겠습니다. 감사합니다.

답변

0

도메인이 없어도 SPF 및/또는 DKIM이없는 Gmail로 메일을 보내지는 못할 것 같습니다. 도메인을 설정하거나 별도의 SMTP 서버를 사용하여 메일을 보내지 않는 이유는 무엇입니까? (예 : https://github.com/PHPMailer/PHPMailer). 또는 Mandrill, Amazon SES, SendGrid 등을 사용하십시오.

관련 문제