리눅스

 

메일 서버 SMTP 설치 및 설정 in Linux

〃server/etcs 


 

CentOS 에서 메일설정을 할 수 있는 방법은 몇가지가 있지만

그중에 자료가 많고 쉽게 할 수 있는 sendmail package를 이용하려고 한다

 

 

1. sendmail package 확인

 

# rpm -qa |grep sendmail

 

sendmail 관련 package가 설치되어 있는지 확인한다.

 

 

 

2. sendmail package 설치

 

sendmail은 기본적으로 두가지 package가 필요하다

sendmail        - 메일 전송 에이전트

sendmail-cf    - sendmail 설정


 

# yum -y install sendmail sendmail-cf

Complete! 를 확인하자

 

 

 

3. 설정파일 수정

 

설정파일을 수정하기 위해서는 mail 서버를 어떠한 용도로 쓸 것인지 명확한 구분이 필요하다

단순 메일 보내기 용도로 사용 할 것인지

받는 메일 서버로도 사용 할 것인지

외부에서 접속이 가능하게 할 것인지 

여러가지 고려사항이 필요하다

여러가지 기능들을 하기위해서는 물론 각각의 설정도 필요 할 것이다

 

# vi /etc/mail/sendmail.mc

 

보통의 경우 sendmai.mc 파일을 수정 후 sendmaial.cf 파일을 다시 생성해 준다

 

 

3-1. 외부접속 허용

115    dnl #

116    DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')dnl

117    dnl #

Addr=127.0.0.1 이 부분을 Addr=0.0.0.0 으로 수정하거나 삭제해 주면 외부 어디에서나 현재 서버의 메일 서비스를 사용 할 수 있다

 

 

3-2. 도메인 변경

158    dnl # The following example makes mail from this host and any additional



159    dnl # specified domains appear to be sent from mydomain.com

160    dnl #

161    dnl MASQUERADE_AS(`mydomain.com')dnl

162    dnl #

 

dnl 주석 제거 후 mydomain.com 부분에 사용할 도메인으로 변경


 

162    dnl # masquerade not just the headers, but the envelope as well

163    dnl #

164    dnl FEATURE(masquerade_envelope)dnl

164    dnl #

dnl 주석 제거

 

 

3-3. SMTP 프로토콜 인증 사용

46    dnl # PLAIN is the preferred plaintext authentication method and used by

47    dnl # Mozilla Mail and Evolution, though Outlook Express and other MUAs do

48    dnl # use LOGIN. Other mechanisms should be used if the connection is not

49    dnl # guaranteed secure.

50    dnl # Please remember that saslauthd needs to be running for AUTH.

51    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. 53 라인 dnl 주석 제거

 

 

3-4. 설정파일 변경

# m4 sendmail.mc > sendmail.cf





4. sendmail 재시작


 

# service sendmail restart

 

 

5. mail 보내기 테스트

mail 명령어를 통해서 보내고자 하는 계정을 입력하면 메일을 쓸 수가 있다

물론 일반 user@naver.com, mail@gmail.com 같은 일반 메일로도 잘 보내진다.

 

 

 

 

 

 

※ 참고1.  mail: command not found

설치가 안되서 생기는 문제다

설치를 해주자


 

# yum -y install mailx



 

※ 참고2.  yum 사용법 - help를 통해서 알아보자

# yum help

 

 

 

 



출처: https://noviceany.tistory.com/48 [novice in anything]

 

 

 

 

 

2. JSP는 메일 보내기

 

http://www.w3big.com/ko/jsp/jsp-sending-email.html

 

 

 

cf ) 리눅스 명령행에서 메일 보내기(send mail from linux command line)

https://www.lesstif.com/lpt/send-mail-from-linux-command-line-24445045.html

 

 


 

 

3.Java/JSP〃간단하고 정확한 문의 메일 보내기 기능 (SMTP)

출처: https://hunit.tistory.com/306 [Ara Blog]

 

 

 

 

 

4.sendmail 로 메일전송 하는데.. 스팸처리가 됩니다.

https://www.cikorea.net/bbs/view/qna?idx=12524

 

 

 

 

 

==>

5.  smtp   도메인 처리 문제

 

 

Sendmail 설치

https://idchowto.com/?p=46936

 

 

https://bloodfinger.tistory.com/33

 

 

 나의  비트 버켓 

 

web_system 프로젝트 참조할것

 

 

 

 

 

 

 

 

 

 

 

about author

PHRASE

Level 60  라이트

죄악은 전생(前生) 것이 더 무섭다 , 전생에 지은 죄는 이승에서 몇 배 더 심하게 받는다는 말.

댓글 ( 5)

댓글 남기기

작성
  •    
  •    
  •