在Linux中,郵件服務是必不可少的一項,但是配置郵件相關的基礎服務是很多新手朋友們的難題。
下文就給夥伴們簡單說下我的基礎郵件配置經驗:
1 開啓郵箱的pop3/smtp服務,qq郵箱需要設置獨立密碼。
2 檢查本機mail端: yum install mailx -y
3 編輯本地郵件服務配置文件信息
法1:分行編寫
vim /etc/mail.rc
set [email protected]
set smtp=smtp.qq.com
set smtp-auth-user=523823198
set smtp-auth-password=your password
set smtp-auth=login
法2:分行編寫
set from=[email protected] \
smtp=smtp.qq.com \
smtp-auth-user=523823198 \
smtp-auth-password=your password \
smtp-auth=login
法3:整行編寫
set from=[email protected] smtp=smtp.qq.com smtp-auth-user=523823198 smtp-auth-password=your password smtp-auth=login
4 發送郵件格式
mail -s "主題" *********@qq.com </data/郵箱測試
或者
echo "郵箱測試"|mail -s "主題" *********@qq.com
5 如果發送不成功
嘗試關掉以下兩項服務
/etc/init.d/postfix stop
/etc/init.d/sendmail stop