使用GMail SMTP寄信 – ssmtp (CentOS)

  1. yum install ssmtp

  2. vim /etc/ssmtp/ssmtp.conf
    root=username@gmail.com
    mailhub=smtp.gmail.com:587
    RewriteDomain=
    Hostname=username@gmail.com
    UseSTARTTLS=yes
    AuthUser=username@gmail.com
    AuthPass=password
    FromLineOverride=YES
    TLS_CA_File=/etc/pki/tls/certs/ca-bundle.crt

  3. alternatives –config mta
    選擇 /usr/sbin/sendmail.ssmtp

  4. 檢查目前sendmail方式
    sendmail -V
    sSMTP 2.61 (Not sendmail at all)

  5. 測試
    echo “This is a test” | mail -s “Test” cowman.chiang@gmail.com

Reference
1. After updating sSMTP to version 2.61 I cannot send mail via gmail
2. How To Setup sSMTP on CentOS 5.9

This entry was posted in CentOS. Bookmark the permalink.