# Centos5에서 Sendmail 구성하기

<table border="1" id="bkmrk-perplexity%EC%97%90%EC%84%9C-%EC%83%9D%EC%84%B1%ED%95%9C-ai%EC%9D%B4" style="border-collapse: collapse; width: 100%;"><colgroup><col style="width: 99.881%;"></col></colgroup><tbody><tr><td>[![image.png](http://igoni.kr/uploads/images/gallery/2026-02/scaled-1680-/8Y5image.png)](http://igoni.kr/uploads/images/gallery/2026-02/8Y5image.png)

</td></tr><tr><td class="align-right">perplexity에서 생성한 AI이미지</td></tr></tbody></table>

1. Sendmail 패키지 설치 ```shell
    $> yum install -y sendmail sendmail-cf
    ```
2. Sendmail 설정
    
    <div><div>  
    </div>
    1. 발송 시 인증을 이용한 메일 발송으로 변경 ```shell
        $> vi /etc/mail/sendmail.mc
        ...
        TRUST_AUTH_MECH(`EXTERNAL DIGEST-MD5 CRAM-MD5 LOGIN PLAIN’)dnl
        ...
        define('confAUTH_MECHANISMS', 'EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 (생략)'
        ...
        ```
    2. 외부에서 25번 포트 접속 허용하기 ```shell
        $> vi /etc/mail/sendmail.mc
        ...
        DAEMON_OPTIONS('Port=smtp, Name=MTA')dnl
        ...
        ```
    3. 발송하는 호스트명 지정 ```Python
        $> vi /etc/mail/sendmail.mc
        LOCAL_DOMAIN('실제_발송할_도메인명')dnl
        ```
    4. Sendmail 버전 숨기기 ```shell
        $> vi /etc/mail/sendmail.mc
        define('confSMTP_LOGIN_MSG')dnl
        ```
    5. Sendmail 서비스 활성화 및 시작 ```shell
        $> chkconfig sendmail on
        $> chkconfig saslauthd on
        $> /etc/init.d/sendmail start
        $> /etc/init.d/saslauthd start
        ```
    
    </div>
3. 포트 확인 ```shell
    $> netstat -antp
    Active Internet connections (servers and established)
    Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
    tcp 0 0 0.0.0.0:25 0.0.0.0:* LISTEN 19466/sendmail
    ```
4. 접속 테스트 ```shell
    $> telnet localhost 25
    mail from:발신계정
    rcpt to:수신계정
    data
    send test
    .
    quit
    (수신계정으로 메일 수신되는지 확인)
     
    ```