使用GMail SMTP寄信 – command (CentOS)

近來發現diary log幾乎都收不到了
測試了一下, 發現連手動執行script都失敗
所以想一下就改用GMail SMTP應該比較保險

Reference: 在 Linux 上直接用 Gmail SMTP 寄信

yum install mailx

vim ~/.mailrc
account gmail {
set smtp-use-starttls
set smtp=smtp://smtp.gmail.com:587
set smtp-auth=login
set smtp-auth-user=username@gmail.com
set smtp-auth-password=password
set from=”username@gmail.com”
set ssl-verify=ignore
set nss-config-dir=/root/.pki/nssdb

set nss-config-dir=/etc/pki/nssdb

}

後續使用
echo ‘信件顯示內容信件顯示內容信件顯示內容’ | mailx -v -A gmail -s “信件標題” 收件者mail

This entry was posted in CentOS. Bookmark the permalink.