차근차근/이것저것

centOS sendmail에서 gmail로 발송이 안됨. 1

예쁜꽃이피었으면 2017. 1. 4. 12:24




상황 : 회원가입 , 비밀번호 찾기 등의 서비스를 제공할 때 사용자에게 메일을 보내는데 gmail은 가지 않고 있다.

스팸함에도 없다.



 https://support.google.com/mail/troubleshooter/2920052?hl=ko&vid=0-61943776300-1483490476426#ts=2920085%2C2923810%2C2923812%2C2923995%2C2924031%2C2924217%2C2924001


이곳에 보니 메일 로그에서 '250 2.0.0 OK <timestamp> <token>' 이 부분이 있는지 확인하라고 한다.   없었고 어떻게 해야 생기는 지 방법을 찾는 중이다..


가장 최근에 영향을 받은 메일의 SMTP 로그를 검사하세요. Gmail 서버에 메일을 전송하려면 로그에 다음 사항이 표시되어야 합니다.


'250 2.0.0 OK <timestamp> <token>'

timestamp는 '1208807740'처럼 표시되는 문자열이고 token은 't2si8527114gve.3'처럼 표시되는 문자열입니다.





http://perte.tistory.com/14


리눅스 로그의 위치 : /var/log/maillog

실시간 메일 로그 : tail -f  /var/log/maillog






텔넷으로 메일 테스트를 해본다.



퍼티로그인 후


telnet localhost 25                                              입력하고 [엔터]


mail from : 보내는 사람 메일주소                           입력하고 [엔터]

rcpt to : 받는 사람@gmail.com                              입력하고 [엔터]

subject : gmail TEST 1                                         입력하고 [엔터]( subject = 제목 )

data                                                                입력하고 [엔터]

내용입력                                                           [엔터]

.                                                                      [엔터] (작성 종료)

quit                                                                  [엔터] (연결 종료)




<로그>


 Jan  4 10:28:48 id sendmail[30136]: v041Qec2030136: from=보내는 사람, size=22, class=0, nrcpts=1, msgid=<201701040128.v041Qec2030136@서버 주소>, proto=SMTP, daemon=MTA, relay=localhost.localdomain [127.0.0.1]

Jan  4 10:28:49 id sendmail[30217]: STARTTLS=client, relay=gmail-smtp-in.l.google.com., version=TLSv1/SSLv3, verify=FAIL, cipher=AES128-SHA, bits=128/128

Jan  4 10:28:50 id sendmail[30217]: v041Qec2030136: to=받는 사람@gmail.com, delay=00:00:43, xdelay=00:00:02, mailer=esmtp, pri=120022, relay=gmail-smtp-in.l.google.com. [64.233.189.27], dsn=5.0.0, stat=Service unavailable

Jan  4 10:28:50 id sendmail[30217]: v041Qec2030136: to=보내는 사람, delay=00:00:43, mailer=local, pri=120022, dsn=5.1.1, stat=User unknown

Jan  4 10:28:50 id sendmail[30217]: v041Qec2030136: v041Soc2030217: postmaster notify: User unknown

Jan  4 10:28:50 id sendmail[30217]: v041Soc2030217: to=root, delay=00:00:00, xdelay=00:00:00, mailer=local, pri=31491, dsn=2.0.0, stat=Sent


눈에 띄는 부분 
dsn=5.0.0
stat=Service unavailable

dsn=5.1.1
stat=User unknown







 

검색어 : Service unavailable,gmail


DSN=5.0.0 Service Unavailable

https://productforums.google.com/forum/#!topic/apps/8rih4sS2Meg





검색어 : stat=User unknown


sendmail 발송 오류

http://www.phpschool.com/gnuboard4/bbs/board.php?bo_table=qna_install&wr_id=91521

=> 문제는 sendmail 설정 이었습니다. /etc/mail/local-host-names 파일의 내용을 전부 주석처리(내용을 삭제해도 되겠지요~) 해버렷더니 잘 됩니다. 


>> 안 됨..


sendmail User unknown 에러가 계속발생합니다.

https://kldp.org/node/116437

=>relay=[127.0.0.1] [127.0.0.1], dsn=5.1.1, stat=User unknown -> 로컬에서 해당 계정을 찾고 있는거 같아요.

서버의 메일데몬을 내리고 테스트 해보시고, 

dns보다 먼저 참고되는 /etc/hosts 파일을 확인해보세요.

옛 기억에 php 폼메일을 작성할때, php.ini 설정을 바꿔줬었던것두 같구요.


>>

send mail 계정

/var/spool/mail


여기에서 보니 추가로 만든 계정이 두개더 있는 데 크기가 0이다.

모든 데이터가.. root로만 가는 것 같다

root를 열어보니 반송된 메일이 보이는데 

X-Authentication-Warning: id.cafe24.com: localhost.localdomain [127.0.0.1] didn't use HELO protocol 

이 부분이 눈에 띄었다.





색어 : localhost 127.0.0.1 didn't use helo protocol


Sendmail 설정 (메일 발송)

http://zetawiki.com/wiki/Sendmail_%EC%84%A4%EC%A0%95_(%EB%A9%94%EC%9D%BC_%EB%B0%9C%EC%86%A1)




검색어 : sendmail user unknown error


[Mail] Sendmail 오류 메시지

http://iamreo.tistory.com/entry/Mail-Sendmail-%EC%98%A4%EB%A5%98-%EB%A9%94%EC%8B%9C%EC%A7%80


Mail Relay and Masquerading

https://www.centos.org/forums/viewtopic.php?t=28245


centos sendmail 계정

http://faq.hostway.co.kr/Linux_Mail/1338

=> 이메일 데이타는 /var/spool/mail/ 폴더에 각 계정 아이디이름으로 생성되어

     메일이 들어 오므로 테스트 메일을 발송해보고 확인 해 볼수 있습니다.




검색어 : 리눅스 메일서버 dns상태


sendmail + DNS 설정하기

http://sfeg.tistory.com/182


>> 

/etc/mail/access

스팸메일을 방지하기 위해 Relay를 허용할 호스트의 IP와 도메인을 설정하는 매우 중요한 파일이다

제어옵션

설명

RELAY

메일 Relay 허용하게 된다관련(host 에서 지정된)메일의 수신/발신을 허용한다.

REJECT

RELAY와는 반대로 메일 RELAY(수발신) 허용하지 않는다.

관련(host 에서 지정된)메일의 수신/발신을 거부한다.

DISCARD

메일을 받은후에 폐기해 버린다메일 발신자에게 폐기통보를 전혀하지 않는다 /etc/sendmail.cf  지정된 $#discard mailer  지정된 곳으로 메일을 폐기한다.(발신자는 메일이 발신된것으로 알게됨)

OK

조건없이 허용한다관련(host 에서지정된)메일의 모든 것을 허용(RELAY)한다.

“501 메시지

메일주소가 일부분이상 일치할 경우에 지정된 메시지 거부하게 된다관련(host 에서지정된메일의 Eamil Address 일치된 메일을 받지 않는다.

“502 메시지

발신메일주소에 host 명이 없을 경우에 메일을 받지 않는다.

“503 메시지

관련(host 에서 지정된) 도메인과 관련된 메일을 받지않음

“550 메시지

특정한 도메인에 대해 지정된 메시지 거부하게 된다.

“571 메시지

주로 스팸메일의 경우에 사용하는 설정으로 지정된 메시지 경로메일을 보낸후에거부하게 된다.

“572 메시지

위의 571 설정과 거의 유사한 설정이다.

 

/etc/mail/access

localhost.localdomain           RELAY

localhost                      RELAY

127.0.0.1                      RELAY

spam.com                     REJECT

다음과 같이 대상에 대한 옵션을 설정한후

makemap hash /etc/mail/access < /etc/mail/access

 같이 실행시켜주면 sendmail 재시작할 필요 없이 access 파일의 내용이 반영된다.


이거 한번 따라해봄... 








검색어 : didn't use HELO protocol



SendMail 에서 5.7.1 에러가 발생합니다.. ㅠ

https://kldp.org/node/125387

=> 

/etc/mail/access 와 /etc/mail/relay-domains 의 내용을 동일하게 하면되는 이슈였네요

sendmail.cf 에서 FR-o /etc/mail/relay-domains 가 주석처리 되어있지는 않는지 확인해봐야 할 것 같습니다.



>> 허허허... /etc/mail/relay-domains 가 없는데...?



X-Authentication-Warning:

http://docstore.mik.ua/orelly/other/Sendmail_3rd/1565928393_ch25-77108.html


Host name didn't use HELO protocol

Every SMTP conversation for transfer of mail must start with the HELO (or EHLO) greeting. If a MAIL command was first instead, this header is inserted in the incoming message. The most likely cause of a missing HELO or EHLO is the mistake of someone attempting to carry on an SMTP conversation by hand.








/var/spool/mail 에서  root를 열어서 다시 보니..


  ----- The following addresses had permanent fatal errors -----

받는 사람@gmail.com

    (reason: 550-5.7.1 [서버주소       1] Our system has detected an unusual rate of)


   ----- Transcript of session follows -----

... while talking to gmail-smtp-in.l.google.com.:

>>> DATA

<<< 550-5.7.1 [서버주소       1] Our system has detected an unusual rate of

<<< 550-5.7.1 unsolicited mail originating from your IP address. To protect our

<<< 550-5.7.1 users from spam, mail sent from your IP address has been blocked.

<<< 550-5.7.1 Please visit

<<< 550-5.7.1  https://support.google.com/mail/?p=UnsolicitedIPError to review our

<<< 550 5.7.1 Bulk Email Senders Guidelines. s68si70745663plb.94 - gsmtp

554 5.0.0 Service unavailable

550 5.1.1 보내는 사람... User unknown


이 부분이 보임... 


https://support.google.com/mail/?p=UnsolicitedIPError



반응형