Jehna :)

CentOS7 postfix로 mail보내기 본문

윌리/System 이것저것

CentOS7 postfix로 mail보내기

Jehna 2017. 3. 31. 17:10

" CentOS7 postfix로 mail보내기 "

- CentOS7에서는 postfix가 기본으로 설치되어 있음

  (다른 버전일 경우, yum -y install postfix로 설치 해야 함)


1. 메일 발송을 위해 /etc/postfix/main.cf 수정

   (기본적인 것만 수정했습니당)

 # 메일 호스트명 

   myhostname = mail.example.com    // 사용하려는 이메일 호스트 입력


 # 도메인 명

   mydomain = example.com            // 사용하려는 이메일 도메인 입력


 # 서버에서 메일 발송시 나타나는 도메인 (From 도메인 설정)

   myorigin = $myhostname


 # 서버에서 메일받을 주소 입력 (all: 전체 수신)

   inet_interfaces = all


 # 메일 수신 도메인 설정

   mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain


 # 메일 서버가 메일을 중계 할 대상을 지정 
   relay_domains = $mydestination

2. postfix 재시작 

systemctl restart postfix 

3. 메일 발송 테스트 

 # telnet localhost 25   

 Trying 192.168.0.128...

 Connected to mail.example.com.

 Escape character is '^]'.

 220 mail.example.com ESMTP Postfix 

 MAIL FROM: test@example.com

 250 2.1.0 Ok

 RCPT TO: OOOO@gmail.com     

 250 2.1.5 Ok 

 DATA

 354 End data with <CR><LF>.<CR><LF>

 Subject: title  

 content12312312312312 

 .

 250 2.0.0 Ok: queued as 918C510055C7

 quit

 221 2.0.0 Bye

 Connection closed by foreign host.