차이

문서의 선택한 두 판 사이의 차이를 보여줍니다.

차이 보기로 링크

양쪽 이전 판이전 판
다음 판
이전 판
tech:postfix [2017/05/29 00:39] V_Ltech:postfix [2022/12/15 14:23] (현재) – [Mail 테스트] V_L
줄 1: 줄 1:
 ====== Postfix ====== ====== Postfix ======
  
-메일서버들을 누구나 구축할 순 있지만 화이트 도메인으로 등록되지 않은 도메인 혹은 IP주소는 대부분 스팸메일로 처리된다. 이러한 경우 Gmail이나 아웃룩 등의 외부 [[SMTP]]를 사용해서 메일을 보내면 된다. [[ssmtp]]등도 있지만, 근래의 메일서버는 간단한 설정이 가능하고, 보안에서 더 우수한 postfix를 많이 사용함.  +메일서버들을 누구나 구축할 순 있지만 화이트 도메인으로 등록되지 않은 도메인 혹은 IP주소는 대부분 스팸메일로 처리된다. 이러한 경우 Gmail이나 아웃룩 등의 외부 [[SMTP]]를 사용해서 메일을 보내면 된다. [[ssmtp]]등도 있지만, 근래의 메일서버는 간단한 설정이 가능하고, 보안에서 더 우수한 postfix를 많이 사용함.
- +
- +
-{{INLINETOC}} +
- +
  
 =====설치===== =====설치=====
줄 19: 줄 14:
 Postfix 메일서버 설치 Postfix 메일서버 설치
  
-설치중에 몇가지 선택할 수 있는데 Internet Site 선택, mail.example.com과 같이 자신의 도메인을 설정+{{https://www.linode.com/docs/assets/1737-postfixsmtp1_sm.png}} 
 + 
 +설치중에 몇가지 선택할 수 있는데 **Internet Site** 선택, mail.example.com과 같이 자신의 **도메인**을 설정
  
   sudo apt-get install postfix   sudo apt-get install postfix
  
 +{{https://www.linode.com/docs/assets/1738-postfixsmtp2_sm.png}}
 =====Postfix 설정===== =====Postfix 설정=====
  
 이를 이용해 메일서버를 설치하고 구글의 SMTP를 이용해 메일을 보내는 방법에 대해 알아봅니다. 이를 이용해 메일서버를 설치하고 구글의 SMTP를 이용해 메일을 보내는 방법에 대해 알아봅니다.
  
-  sudo vi /etc/postfix/main.cf+  sudo nano /etc/postfix/main.cf
 아래의 내용을 하단에 붙여넣기 아래의 내용을 하단에 붙여넣기
  
-<file conf+<file bash
-relayhost = [smtp.gmail.com]:587+  - enable SASL authentication 
 smtp_sasl_auth_enable = yes smtp_sasl_auth_enable = yes
-smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd+  - disallow methods that allow anonymous authentication. 
 smtp_sasl_security_options = noanonymous smtp_sasl_security_options = noanonymous
-smtp_tls_CAfile = /etc/postfix/cacert.pem+  - where to find sasl_passwd 
 +smtp_sasl_password_maps hash:/etc/postfix/sasl_passwd 
 +  - Enable STARTTLS encryption 
 smtp_use_tls = yes smtp_use_tls = yes
 +#where to find CA certificates
 +smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt
 +
 +relayhost = [smtp.gmail.com]:587
 +
 +smtp_sasl_auth_enable = yes
 +smtp_tls_CAfile = /etc/postfix/cacert.pem
 +
 </file> </file>
 +
 +  * 이름: smtp-mail.outlook.com
 +  * 포트: 587
 +  * 암호화 방법: STARTTLS
  
 sasl_passwd 파일을 생성하고 이 파일에 gmail 계정과 패스워드를 생성 sasl_passwd 파일을 생성하고 이 파일에 gmail 계정과 패스워드를 생성
  
-sudo vi /etc/postfix/sasl_passwd+  sudo nano /etc/postfix/sasl_passwd
 [email protected]:PASSWORD 부분에 자신의 Gmail 계정과 패스워드 입력 [email protected]:PASSWORD 부분에 자신의 Gmail 계정과 패스워드 입력
  
-만일 구글앱스를 사용해 도메인을 이용중이면 @gmail.com 대신에 @도메인주소를 사용가능+만일 구글앱스를 사용해 도메인을 이용중이면 ''@gmail.com'' 대신에 ''@도메인주소'' 를 사용가능
  
-[smtp.gmail.com]:587    [email protected]:PASSWORD+  [smtp.gmail.com]:587    [email protected]:PASSWORD
  
 권한 변경 및 Postfix 설정 업데이트 권한 변경 및 Postfix 설정 업데이트
줄 56: 줄 68:
   cat /etc/ssl/certs/Thawte_Premium_Server_CA.pem | sudo tee -a /etc/postfix/cacert.pem   cat /etc/ssl/certs/Thawte_Premium_Server_CA.pem | sudo tee -a /etc/postfix/cacert.pem
 Postfix 재시작 Postfix 재시작
- +
   sudo /etc/init.d/postfix reload   sudo /etc/init.d/postfix reload
 +
 +====outlook====
 +  IMAP 서버 이름: outlook.office365.com
 +  IMAP 포트: 993
 +  IMAP 암호화 방법: LS
 +
 +  POP 서버 이름: outlook.office365.com
 +  POP 포트: 995
 +  POP 암호화 방법: LS
 +
 +  SMTP 서버 이름: smtp.office365.com
 +  SMTP 포트: 587
 +  SMTP 암호화 방법: STARTTLS
 +
 =====Mail 테스트===== =====Mail 테스트=====
 [email protected]에 메일을 보낼주소를 입력 [email protected]에 메일을 보낼주소를 입력
줄 64: 줄 90:
 이렇게 메일을 보내게 되면 구글 계정의 메일로 발송한 것이 되어 보낸편지함에 이력이 남기도 한다. 다만 하루에 500통의 메일 전송제약이 있다. 이렇게 메일을 보내게 되면 구글 계정의 메일로 발송한 것이 되어 보낸편지함에 이력이 남기도 한다. 다만 하루에 500통의 메일 전송제약이 있다.
  
-참고 : http://rtcamp.com/wordpress-nginx/tutorials/linux/ubuntu-postfix-gmail-smtp/+[[http://rtcamp.com/wordpress-nginx/tutorials/linux/ubuntu-postfix-gmail-smtp/|출처1(영문)]] 
 +
 +[[http://webdir.tistory.com/227|출처2]]  [[https://openbee.kr/435|참고]] 
 + 
 +메일이 오면 /var/mail 에 아이디 파일명으로 저장된다. 
 + 
 +메일 로그 확인 
 +  tail -f /var/log/mail.log 
 +   
 +   
 +=====메일큐확인===== 
 +1. 메일 큐 전체 비우기 
 + 
 +# postfix flush   또는 postfix -f 
 + 
 + 
 +2. 현재 쌓인 메일 확인 
 + 
 +# mailq 
 + 
 + 
 +3. 메일큐 전체 삭제 
 + 
 +# postsuper -d ALL 
  
-[[http://webdir.tistory.com/227|출처 WEBDIR]]+4메일큐에서 deferred 된 메일만 삭제
  
-{{tag>postfix}}+# postsuper -d ALL deferred