Tip: Install and Setting ssmtp for FreePBX

    內容表格
    1. 1. ssmtp
    2. 2. 步驟開始

    版本為 02:27, 21 Nov 2024

    到這個版本。

    返回到 版本存檔.

    查閱目前版本

    系統環境:

    • CentOS 5.4
    • Asterisk-1.4.21.2
    • FreePBX-2.6.0.1
    • Sendmail-8.13.8-2.el5

    ssmtp

    // http://wiki.centos.org/AdditionalRes...t=Repositories

    wget http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm 
    rpm -ivh epel-release-5-4.noarch.rpm
    
    yum install ssmtp
    vi /etc/ssmtp/ssmtp.conf
    # Get enhanced (*really* enhanced) debugging information in the logs
    # If you want to have debugging of the config file parsing, move this option
    # to the top of the config file and uncomment
    #Debug=YES
    
    # For SMTP relay with gmail server
    #root=postmaster
    #AuthUser=myname@gmail.com
    #AuthPass=password
    #FromLineOverride=YES
    #mailhub=smtp.gmail.com:587
    #UseSTARTTLS=YES
    
    # For SMTP server
    MailHub=your.smtp.server:5525      # SMTP server hostname and port
    #UseTLS=YES                        # Secure connection (SSL/TLS)
    FromLineOverride=YES               # Force the From: line
    Hostname=pbx.my.domain             # The name of this host
    RewriteDomain=my.domain            # The host the mail appears to be coming from
    Root=postmaster                    # Redirect mail for root@ to postmaster@
    AuthUser=user@your.smtp.server     # Your SMTP server mail account
    AuthPass=password                  # Your SMTP server mail password
    AuthMethod=CRAM-MD5
    

    //

    步驟開始

    編輯 /etc/mail/sendmail.mc

    cd /etc/mail
    cp -a sendmail.mc sendmail.mc.orig
    vi sendmail.mc 
    

    搜尋 SMART_HOST

    define(`SMART_HOST', `your.smtp.server')dnl
    define(`RELAY_MAILER_ARGS', `TCP $h 587')
    define(`ESMTP_MAILER_ARGS', `TCP $h 587')
    

    搜尋 masquerade_envelope

    FEATURE(masquerade_envelope)dnl
    FEATURE(genericstable, `hash -o /etc/mail/genericstable')
    GENERICS_DOMAIN_FILE(`/etc/mail/genericsdomain')dnl
    

    搜尋 confAUTH_MECHANISMS

    define(`confAUTH_MECHANISMS', `EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
    FEATURE(`authinfo',`hash /etc/mail/auth/client-info')dnl
    

    新增 domain 設定

    cd /etc/mail
    hostname -f > genericsdomain
    touch genericstable
    makemap -r hash genericstable.db < genericstable 
    

    NOTES:

    執行 hostname -f 出現錯誤 Unknow host
    請檢查 /etc/hosts 有無紀錄

    新增 SMTP 認證帳號及密碼的設定

    cd /etc/mail
    mkdir auth
    chmod 700 auth/
    cd auth/
    vi client-info 
    
    AuthInfo:your.smtp.server "U:smmsp" "I:userid" "P:password" "M:PLAIN"
    AuthInfo:your.smtp.server:587 "U:smmsp" "I:userid" "P:password" "M:PLAIN"
    

    NOTES:

    your.smtp.server SMTP 主機位址
    userid SMTP 帳號
    password SMTP密碼

    chmod 0600 client-info
    makemap -r hash client-info.db < client-info
    service sendmail restart 
    

    //

    Powered by MindTouch Core