使用shell脚本发送邮件带附件

本文介绍了如何配置并使用Shell脚本发送带有附件的邮件。首先讲解了授权码的获取,然后启动postfix服务。接着,讨论了创建认证和配置mail.rc的步骤。最后,分别展示了发送邮件不加附件和加附件的shell脚本用法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

配置

1、授权码:
在邮箱设置里面开启授权码授权。
在这里插入图片描述
2、启动postfix
1.1 启动postfix
#sendmial
service sendmail stop
chkconfig sendmail off

#postfix
service postfix start
chkconfig postfix on

如果postfix start失败
[root@rzdatahadoop002 ~]# postfix check
postfix: error while loading shared libraries: libmysqlclient.so.16: cannot open shared object file: No such file or directory
[root@rzdatahadoop002 ~]# rpm -qa|grep mysql
[root@rzdatahadoop002 ~]# yum install mysql-libs

创建认证
mkdir -p /root/.certs/
echo -n | openssl s_client -connect smtp.163.com:465 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > ~/.certs/163.crt
certutil -A -n "GeoTrust SSL CA" -t "C,," -d ~/.certs -i 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值