顯示頁面舊版反向連結Fold/unfold all回到頁頂 本頁是唯讀的,您可以看到原始碼,但不能更動它。您如果覺得它不應被鎖上,請詢問管理員。 ====== CentOS7 設定 mailx 寄出 log 方式 ====== * 安裝 mailx <code sh> yum install mailx </code> * 修改 /etc/mail.rc 參考以下設定<file> : : set from=jonathan@mail.ichiayi.com # 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 smtp-auth-user=user@domain.tld 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 </file> * 驗證是否可寄出測試信 <code sh> echo "TEST...信件內容" | mail -s "TEST Sub..信件主旨" jtsai@ichiayi.com </code>如果成功測試結果類似以下訊息<cli> [root@pve-rclone ~]# echo "TEST...1" | mail -s "TEST Sub..1" jtsai@ichiayi.com [root@pve-rclone ~]# Error in certificate: Peer's certificate issuer is not recognized. </cli> <note> * 出現 Error in certificate: Peer's certificate issuer is not recognized. 是憑證無法驗證是否合法的訊息, 因為有設定 <file>set ssl-verify=ignore</file>所以信件還是可以寄出 </note> ===== 參考網址 ===== *https://www.digitalocean.com/community/tutorials/how-to-send-e-mail-alerts-on-a-centos-vps-for-system-monitoring *https://codertw.com/%E7%A8%8B%E5%BC%8F%E8%AA%9E%E8%A8%80/449503/ {{tag>mail}} tech/mailx.txt 上一次變更: 2021/01/16 14:41由 jonathan