본문 바로가기

CentOS 메일 보내기 - SMTP 설치 가이드

액트 2019. 12. 19.
반응형

[CentOS 7] 메일 보내기 - SMTP 설치 가이드


사전 준비 사항

  • SMTP 메일 서버 Port 오픈
[root@test ~]# firewall-cmd --zone=public --permanent --add-port=25/tcp

success

[root@test ~]# firewall-cmd --reload

success

 

SMTP 설치

 

1. sendmail 설치 여부 확인

[root@test ~]# rpm -qa |grep sendmail

 

2. sendmail 설치

  • sendmail : 메일 전송 에이전트
  • sendmail-cf : sendmail 설정
[root@test ~]# yum install -y sendmail sendmail-cf

Loaded plugins: fastestmirror

Loading mirror speeds from cached hostfile

 * base: ftp.kaist.ac.kr

..

..

Complete!

[root@test ~]#

 

3. sendmail 설정

  1) /etc/mail폴더로 이동하여 sendmail.mc 파일 확인

[root@test mail]# pwd

/etc/mail

[root@mtest mail]# ls

access           domaintable.db    mailertable.db  sendmail.mc    virtusertable

access.db        helpfile          make            submit.cf      virtusertable.db

aliasesdb-stamp  local-host-names  Makefile        submit.mc

domaintable      mailertable       sendmail.cf     trusted-users

[root@test mail]# vi sendmail.mc

 

2) sendmail.mc 파일 변경 - SMTP 사용

  • 52,53라인의 주석 제거(dnl 옵션이 주석!!)  
  • 다른 옵션은 인터넷 검색
----  변경 전 ----

52 dnl TRUST_AUTH_MECH(`EXTERNAL DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl

53 dnl define(`confAUTH_MECHANISMS', `EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl





---- 변경 후 ----

52 TRUST_AUTH_MECH(`EXTERNAL DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl

53 define(`confAUTH_MECHANISMS', `EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl

 

3) sendmail.mc 로 sendmail.cf 파일 생성 

[root@test mail]# m4 sendmail.mc > sendmail.cf

 

3. sendmail 실행  

[root@test mail]# systemctl start sendmail


4. mail 테스트

  • mailx 설치
  • Subject: 제목 입력
  • 빈칸: 본문 내용
  • 본문 작성 완료 후 [control] + D 키 누르면 EOT 뜨면서 메일 작성 종료
[root@test ~]# yum -y install mailx

[root@test ~]# mail curvc@naver.com

Subject: test

test

test

.

EOT

[root@test ~]#

 

5. 메일 전송이 되지 않고, 로그에 rejecting connections on daemon MTA: load average: 12 가 표시될 경우

  1)sendmail.cf 파일 변경 - Refuse Load Average 값 변경

  • 395라인의 주석(#) 제거
  • 값을 12에서 30으로 변경
[root@test mail]# pwd

/etc/mail

[root@test mail]# vi sendmail.cf



----  변경 전 ----

394 # load average at which we refuse connections

395 #O RefuseLA=12



----  변경 후 ----

394 # load average at which we refuse connections

395 O RefuseLA=30



[root@test mail]# systemctl restart sendmail
  • 참고 QueueLA : 처리 중인 메일 프로세스가 해당 수치에 도달하면 전송을 중단하고 큐에 쌓은 다음 나중에 처리.
  • RefuseLA : 메일 프로세스가 해당 수치에 도달하면 접속을 거부.  
반응형

댓글