"Sendmail 설정 (메일 발송)"의 두 판 사이의 차이

 
(사용자 3명의 중간 판 30개는 보이지 않습니다)
1번째 줄: 1번째 줄:
;sendmail 설정
;sendmail 설정 #1 (메일 발송)
;sendmail 메일발송


==사전 작업==
==사전 작업==
5번째 줄: 6번째 줄:


==sendmail.mc 수정==
==sendmail.mc 수정==
<source lang='cli'>
<source lang='console'>
[root@zetawiki ~]# cp /etc/mail/sendmail.mc /etc/mail/sendmail.mc.original
[root@zetawiki ~]# cp /etc/mail/sendmail.mc /etc/mail/sendmail.mc.original
[root@zetawiki ~]# vi /etc/mail/sendmail.mc
[root@zetawiki ~]# vi /etc/mail/sendmail.mc
15번째 줄: 16번째 줄:
< dnl define(`confAUTH_MECHANISMS', `EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
< dnl define(`confAUTH_MECHANISMS', `EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
---
---
> dnl #TRUST_AUTH_MECH(`EXTERNAL DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
> #TRUST_AUTH_MECH(`EXTERNAL DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
> dnl #define(`confAUTH_MECHANISMS', `EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
> #define(`confAUTH_MECHANISMS', `EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
116c116
< DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')dnl
---
> DAEMON_OPTIONS(`Port=smtp,Addr=0.0.0.0, Name=MTA')dnl
</source>
</source>


==sendmail.cf 생성==
==sendmail.cf 생성/보존==
*생성, 보존, 편집, 비교
<source lang='console'>
<source lang='cli'>
[root@zetawiki ~]# m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf
[root@zetawiki ~]# m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf
[root@zetawiki ~]# cp /etc/mail/sendmail.cf /etc/mail/sendmail.cf.original
[root@zetawiki ~]# cp /etc/mail/sendmail.cf /etc/mail/sendmail.cf.original
[root@zetawiki ~]# vi /etc/mail/sendmail.cf
[root@zetawiki ~]# diff /etc/mail/sendmail.cf.original /etc/mail/sendmail.cf
</source>
<source lang='diff'>
95c95
< #Dj$w.Foo.COM
---
> Djzetawiki.com
445c445
< O SmtpGreetingMessage=$j Sendmail $v/$Z; $b
---
> O SmtpGreetingMessage=$j Sendmail $b
</source>
</source>


==서비스 재시작==
==서비스 재시작==
<source lang='cli'>
<source lang='console'>
[root@zetawiki ~]# service sendmail restart
[root@zetawiki ~]# service sendmail restart
Shutting down sm-client:                                  [  OK  ]
Shutting down sm-client:                                  [  OK  ]
49번째 줄: 33번째 줄:
Starting sendmail:                                        [  OK  ]
Starting sendmail:                                        [  OK  ]
Starting sm-client:                                        [  OK  ]
Starting sm-client:                                        [  OK  ]
</source>
==포트 확인==
<source lang='console'>
[root@zetawiki ~]# netstat -anp | grep sendmail | grep LISTEN
tcp        0      0 127.0.0.1:25                0.0.0.0:*                  LISTEN      29403/sendmail
</source>
</source>


==메일 발송 테스트 1==
==메일 발송 테스트 1==
<source lang='cli'>
<source lang='console'>
[root@zetawiki ~]# telnet localhost 25
[root@zetawiki ~]# telnet localhost 25
Trying ::1...
Trying ::1...
59번째 줄: 49번째 줄:
Connected to localhost.
Connected to localhost.
Escape character is '^]'.
Escape character is '^]'.
220 zetawiki.com ESMTP Sendmail 8.14.4/8.14.4; Wed, 25 Feb 2015 09:30:26 +0900
220 zetawiki.com ESMTP Sendmail 8.14.4/8.14.4; Wed, 25 Feb 2015 11:22:53 +0900
mail from: root@zetawiki.com
mail from: root@zetawiki.com
250 2.1.0 root@zetawiki.com... Sender ok
250 2.1.0 root@zetawiki.com... Sender ok
rcpt to: 지메일계정@gmail.com
rcpt to: seakyj2114@gmail.com
250 2.1.5 지메일계정@gmail.com... Recipient ok
250 2.1.5 seakyj2114@gmail.com... Recipient ok
data
data
354 Enter mail, end with "." on a line by itself
354 Enter mail, end with "." on a line by itself
hello, sendmail test.
hello, sendmail test.
.
.
250 2.0.0 t1P0UQNG027816 Message accepted for delivery
250 2.0.0 t1P2MrX0029423 Message accepted for delivery
quit
quit
221 2.0.0 zetawiki.com closing connection
221 2.0.0 zetawiki.com closing connection
Connection closed by foreign host.
Connection closed by foreign host.
</source>
</source>
<source lang='cli'>
<source lang='console'>
[root@zetawiki ~]# cat /var/log/maillog | grep t1P0UQNG027816
[root@zetawiki ~]# cat /var/log/maillog | grep t1P2MrX0029423
Feb 25 09:30:38 zetawiki sendmail[27816]: t1P0UQNG027816: Authentication-Warning: zetawiki.com: zetawiki [127.0.0.1] didn't use HELO protocol
Dec 18 11:23:22 zetawiki sendmail[29423]: t1P2MrX0029423: Authentication-Warning: zetawiki: zetawiki.com [127.0.0.1] didn't use HELO protocol
Feb 25 09:31:06 zetawiki sendmail[27816]: t1P0UQNG027816: from=root@zetawiki.com, size=22, class=0, nrcpts=1, msgid=<201502250030.t1P0UQNG027816@zetawiki.com>, proto=SMTP, daemon=MTA, relay=zetawiki [127.0.0.1]
Dec 18 11:23:43 zetawiki sendmail[29423]: t1P2MrX0029423: from=root@zetawiki.com, size=22, class=0, nrcpts=1, msgid=<201502250223.t1P2MrX0029423@zetawiki.com>, proto=SMTP, daemon=MTA, relay=zetawiki.com [127.0.0.1]
Feb 25 09:31:10 zetawiki sendmail[27827]: t1P0UQNG027816: to=지메일계정@gmail.com, ctladdr=root@zetawiki.com (0/0), delay=00:00:22, xdelay=00:00:04, mailer=esmtp, pri=120022, relay=gmail-smtp-in.l.google.com. [173.194.72.26], dsn=2.0.0, stat=Sent (OK 1424824357 km10si6230428pbc.75 - gsmtp)
Dec 18 11:23:46 zetawiki sendmail[29429]: t1P2MrX0029423: to=seakyj2114@gmail.com, ctladdr=root@zetawiki.com (0/0), delay=00:00:11, xdelay=00:00:03, mailer=esmtp, pri=120022, relay=gmail-smtp-in.l.google.com. [74.125.204.27], dsn=2.0.0, stat=Sent (OK 1424831114 ir10si9135493pbc.62 - gsmtp)
</source>
</source>
:← 정상 발송됨(Sent OK)
:← 정상 발송됨(Sent OK)
*Gmail에서 확인해보니 메일이 잘 도착하였음
*Gmail에서 확인해보니 메일이 잘 도착하였음
:보낸 사람: root <root@zetawiki.com>
:제목: (제목 없음)
:내용: hello, sendmail test.


==메일 발송 테스트 2==
==메일 발송 테스트 2==
<source lang='cli'>
<source lang='console'>
[root@zetawiki ~]# echo 'this is test2.' | mail -s 'sendmail test2' 지메일계정@gmail.com
[root@zetawiki ~]# echo 'this is test2.' | mail -s 'sendmail test2' 지메일계정@gmail.com
</source>
</source>
*gmail에서 확인하니 메일이 잘 도착하였음
*gmail에서 확인하니 메일이 잘 도착하였음
:보낸사람: root <root@zetawiki.com>
:보낸사람: root <root@zetawiki>
:제목: sendmail test2
:제목: sendmail test2
:본문: this is test2.
:본문: this is test2.
==후속 작업==
*[[sendmail 네이버, 다음, 네이트, 지메일 메일발송 테스트]]
*[[sendmail 설정 (메일 수신)]]


==같이 보기==
==같이 보기==
*[[sendmail 설치]]
*[[sendmail 설치]]
*[[sendmail]]
*[[PHP mail() 메일 발송 테스트]]


==참고 자료==
==참고==
*http://betatester.tistory.com/28
*http://betatester.tistory.com/28
*http://kslovee.tistory.com/207
*http://kslovee.tistory.com/207


[[분류: sendmail]]
[[분류: sendmail]]
[[분류: SMTP]]

2019년 8월 13일 (화) 13:48 기준 최신판

sendmail 설정 #1 (메일 발송)
sendmail 메일발송

1 사전 작업[ | ]

2 sendmail.mc 수정[ | ]

[root@zetawiki ~]# cp /etc/mail/sendmail.mc /etc/mail/sendmail.mc.original
[root@zetawiki ~]# vi /etc/mail/sendmail.mc
[root@zetawiki ~]# diff /etc/mail/sendmail.mc.original /etc/mail/sendmail.mc
52,53c52,53
< dnl TRUST_AUTH_MECH(`EXTERNAL DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
< dnl define(`confAUTH_MECHANISMS', `EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
---
> #TRUST_AUTH_MECH(`EXTERNAL DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
> #define(`confAUTH_MECHANISMS', `EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl

3 sendmail.cf 생성/보존[ | ]

[root@zetawiki ~]# m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf
[root@zetawiki ~]# cp /etc/mail/sendmail.cf /etc/mail/sendmail.cf.original

4 서비스 재시작[ | ]

[root@zetawiki ~]# service sendmail restart
Shutting down sm-client:                                   [  OK  ]
Shutting down sendmail:                                    [  OK  ]
Starting sendmail:                                         [  OK  ]
Starting sm-client:                                        [  OK  ]

5 포트 확인[ | ]

[root@zetawiki ~]# netstat -anp | grep sendmail | grep LISTEN
tcp        0      0 127.0.0.1:25                0.0.0.0:*                   LISTEN      29403/sendmail

6 메일 발송 테스트 1[ | ]

[root@zetawiki ~]# telnet localhost 25
Trying ::1...
telnet: connect to address ::1: Connection refused
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
220 zetawiki.com ESMTP Sendmail 8.14.4/8.14.4; Wed, 25 Feb 2015 11:22:53 +0900
mail from: root@zetawiki.com
250 2.1.0 root@zetawiki.com... Sender ok
rcpt to: seakyj2114@gmail.com
250 2.1.5 seakyj2114@gmail.com... Recipient ok
data
354 Enter mail, end with "." on a line by itself
hello, sendmail test.
.
250 2.0.0 t1P2MrX0029423 Message accepted for delivery
quit
221 2.0.0 zetawiki.com closing connection
Connection closed by foreign host.
[root@zetawiki ~]# cat /var/log/maillog | grep t1P2MrX0029423 
Dec 18 11:23:22 zetawiki sendmail[29423]: t1P2MrX0029423: Authentication-Warning: zetawiki: zetawiki.com [127.0.0.1] didn't use HELO protocol
Dec 18 11:23:43 zetawiki sendmail[29423]: t1P2MrX0029423: from=root@zetawiki.com, size=22, class=0, nrcpts=1, msgid=<201502250223.t1P2MrX0029423@zetawiki.com>, proto=SMTP, daemon=MTA, relay=zetawiki.com [127.0.0.1]
Dec 18 11:23:46 zetawiki sendmail[29429]: t1P2MrX0029423: to=seakyj2114@gmail.com, ctladdr=root@zetawiki.com (0/0), delay=00:00:11, xdelay=00:00:03, mailer=esmtp, pri=120022, relay=gmail-smtp-in.l.google.com. [74.125.204.27], dsn=2.0.0, stat=Sent (OK 1424831114 ir10si9135493pbc.62 - gsmtp)
← 정상 발송됨(Sent OK)
  • Gmail에서 확인해보니 메일이 잘 도착하였음
보낸 사람: root <root@zetawiki.com>
제목: (제목 없음)
내용: hello, sendmail test.

7 메일 발송 테스트 2[ | ]

[root@zetawiki ~]# echo 'this is test2.' | mail -s 'sendmail test2' 지메일계정@gmail.com
  • gmail에서 확인하니 메일이 잘 도착하였음
보낸사람: root <root@zetawiki>
제목: sendmail test2
본문: this is test2.

8 후속 작업[ | ]

9 같이 보기[ | ]

10 참고[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}