動態

詳情 返回 返回

Linux用QQ郵箱發送郵件 - 動態 詳情

[toc]

Linux用QQ郵箱發送郵件

運維工程師工作中經常會需要用郵箱去接收服務器告警信息,可以使用下面方式配置QQ郵箱發送郵件接收告警。

登錄QQ郵箱---賬號與安全---安全設置---生成授權碼

image-20250818213452943.png

服務器配置

centos

# 安裝客户端
yum install mailx -y

# 配置郵箱信息
[root@centos7 ~]# vim /etc/mail.rc 
set from=122841644@qq.com   # 填寫自己的郵箱地址
set smtp=smtp://smtp.qq.com:587
set smtp-auth-user=122841644@qq.com   # 填寫自己的郵箱地址
set smtp-auth-password="填寫自己生成的授權碼"
set smtp-auth=login
set ssl-verify=ignore
set smtp-use-starttls
set nss-config-dir=/etc/pki/nssdb

# 發送郵件測試
echo 'linux mail test' | mail -s 'mail test' waluna@qq.com
# 24年後QQ加強安全驗證,有報錯忽略就好。

Ubuntu

# 安裝客户端
apt install s-nail -y

# 配置郵箱信息
[root@ubuntu2204 ~]# vim /etc/s-nail.rc
set from=122841644@qq.com   # 填寫自己的郵箱地址
set smtp=smtp://smtp.qq.com:587
set smtp-auth-user=122841644@qq.com   # 填寫自己的郵箱地址
set smtp-auth-password="填寫自己生成的授權碼"
set smtp-auth=login
set ssl-verify=ignore
set smtp-use-starttls
set nss-config-dir=/etc/pki/nssdb

# 發送郵件測試
echo 'linux mail test' | s-nail -s 'mail test' waluna@qq.com
# 24年後QQ加強安全驗證,有報錯忽略就好。

去郵箱查看郵件

image-20250818214052855.png


關於我
全網可搜《阿賢Linux》
CSDN、知乎、嗶哩嗶哩、博客園、51CTO、掘金、思否、阿里雲、騰訊雲、華為雲、今日頭條、百家號、GitHub、個人博客
公眾號:阿賢Linux
個人博客:blog.waluna.top
https://blog.waluna.top/

原文鏈接: Linux用QQ郵箱發送郵件.

user avatar coulthard 頭像 wodekouwei 頭像 sysin 頭像 kindledawn 頭像 guoduandemuer 頭像 q_bit 頭像 lazytimes 頭像 xvrzhao 頭像 leixue 頭像 shiyibodec 頭像 womaxuanhuang 頭像 null_null_null 頭像
點贊 14 用戶, 點贊了這篇動態!
點贊

Add a new 評論

Some HTML is okay.