Linux Centos配置邮件发送

Linux Centos配置邮件发送

这里使用的是外部发送邮件方式,也就是使用自己的账号发送

第一步

首先要开启STMP授权码,以QQ邮箱为例

配置文件

sh 复制代码
vim /etc/mail.rc

找到之后在最下面添加如下

复制代码
#邮箱
 
set from=3324855376@qq.com 
 
#默认smtp发送,stmp发送需要在邮箱内配置,允许stmp发送
 
set smtp=smtp.qq.com
 
#邮箱
set smtp-auth-user=3324855376@qq.com
#邮箱授权码
 
set smtp-auth-password=xkhqkjleqxewchhd
 
set smtp-auth=login

发送邮件-不带附件

sh 复制代码
# 方式一
 echo "This is the mail body" | mail -s "邮件标题" 1319900154@qq.com
# 方式二,将文本内容放入邮件body中
 mail -s "邮件标题" 1319900154@qq.com < /etc/passwd

发送邮件-带附件

sh 复制代码
mail -s "This is the mail body" -a /home/ttt.txt  1319900154@qq.com < /etc/passwd
相关推荐
C_心欲无痕1 天前
ts - tsconfig.json配置讲解
linux·前端·ubuntu·typescript·json
冰西瓜6001 天前
国科大2025操作系统高级教程期末回忆版
linux
HIT_Weston1 天前
93、【Ubuntu】【Hugo】搭建私人博客:面包屑(一)
linux·运维·ubuntu
cuijiecheng20181 天前
Linux下Beyond Compare过期
linux·运维·服务器
喵叔哟1 天前
20.部署与运维
运维·docker·容器·.net
HIT_Weston1 天前
92、【Ubuntu】【Hugo】搭建私人博客:侧边导航栏(六)
linux·运维·ubuntu
CodeAllen嵌入式1 天前
Windows 11 本地安装 WSL 支持 Ubuntu 24.04 完整指南
linux·运维·ubuntu
码农小韩1 天前
基于Linux的C++学习——指针
linux·开发语言·c++·学习·算法
wdfk_prog1 天前
[Linux]学习笔记系列 -- [fs]seq_file
linux·笔记·学习
Jay Chou why did1 天前
wsl安装完无法进入wsl
linux