티스토리 뷰

Ubuntu

ubuntu - sendmail 하는 방법

realizers 2021. 1. 28. 18:12
728x90
반응형
1. 설치 확인
telnet localhost 25

Trying 127.0.0.1...
telnet: Unable to connect to remote host: Connection refused
라고 나오면 설치를 하자!

 

2. sendmail 설치
$ sudo apt-get install sendmail

3. 설정변경
$ sudo vi /etc/mail/sendmail.mc

DAEMON_OPTIONS(`Family=inet, Name=MTA-v4, Port=smtp, Addr=127.0.0.1')dnl

DAEMON_OPTIONS(`Family=inet, Name=MSP-v4, Port=submission, M=Ea, Addr=127.0.0.1')dnl

127.0.0.1 => 0.0.0.0 으로 변경

 

4. config 파일 생성
$ sudo m4 /etc/mail/sendmail.mc

 

5. 설정변경
$ sudo vi /etc/mail/access 맨 마지막에 추가
192.168.0 RELAY

 

6. sendmail 다시시작
$ sudo service sendmail restart

 

7. 메일전송테스트
telnet localhost 25
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
220 ip-172-31-33-107.ap-northeast-2.compute.internal ESMTP Sendmail 8.15.2/8.15.2/Debian-10; Tue, 26 Apr 2022 02:14:35 GMT; (No UCE/UBE) logging access from: localhost(OK)-localhost [127.0.0.1]

입력 ==> HELO localhost
250 ip-172-31-33-107.ap-northeast-2.compute.internal Hello localhost [127.0.0.1], pleased to meet you
입력 ==> mail from : test@gmail.com //보내는 사람
250 2.1.0 test... Sender ok
입력 ==>  rcpt to: test1@gmail.com // 받는 사람
250 2.1.5 test1... Recipient ok
입력 ==>  data
354 Enter mail, end with "." on a line by itself
입력 ==>  test mail 1234 // 내용 입력
입력 ==>  . // 마무리
250 2.0.0 23Q2EZc1011973 Message accepted for delivery
quit

 

참고. 메일발송이 느린경우
$ sudo vi /etc/hosts 파일을 아래와 같이 수정
127.0.0.1 localhost localhost.localdomain myhostname

 

728x90
반응형