CentOS7 設定 mailx 寄出 log 方式

  • 安裝 mailx
    yum install mailx
  • 修改 /etc/mail.rc 參考以下設定
    :
    :
    set [email protected]
    # set smtp=smtp://smtp.server.tld:port_number
    set smtp=smtp://mail.ichiayi.com:587
    # tell mailx that it needs to authorise
    set smtp-auth=login
    # set the user for SMTP
    # set [email protected]
    set smtp-auth-user=jonathan
    # set the password for authorisation
    set smtp-auth-password=**mypassword**
    set ssl-verify=ignore
    set nss-config-dir=/etc/pki/nssdb
    set smtp-use-starttls=yes
    
  • 驗證是否可寄出測試信
    echo "TEST...信件內容" | mail -s "TEST Sub..信件主旨" [email protected]

    如果成功測試結果類似以下訊息

    [root@pve-rclone ~]# echo "TEST...1" | mail -s "TEST Sub..1" [email protected]
    [root@pve-rclone ~]# Error in certificate: Peer's certificate issuer is not recognized.
  • 出現 Error in certificate: Peer's certificate issuer is not recognized. 是憑證無法驗證是否合法的訊息, 因為有設定
    set ssl-verify=ignore

    所以信件還是可以寄出

  • tech/mailx.txt
  • 上一次變更: 2021/01/16 14:41
  • jonathan