mailx 外邮 手动执行可以,在crontab中报错

xuuyaoo xuuyaoo 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
我在/etc/nail.rc中配置了外部邮箱参数。

set from=abc@qq.com
set smtp=smtp.qq.com
set smtp-auth-user=abc
set smtp-auth-password=123456
set smtp-auth=login


sendmail.sh
----------------------
#!/bin/sh
echo "test"|mailx -v -s "test" "desc@qq.com"


手动直接执行sh sendmail.sh,可以发送成功。
Resolving host stmp.qq.com. . . done.
Connecting to 61.129.71.101 . . . connected.
.....
.....


但将sendmail.sh添加到crontab中就出现以下错误:::
abc@qq.com... Connecting to [127.0.0.1] via relay...
abc@qq.com... Deferred: Connection refused by [127.0.0.1]


为什么连接的主机不一样,手动执行连接的邮件服务器是我设置的外部邮件服务器,crontab执行连接的服务器好像是本地?是不是哪里少配置了?
求指教,谢谢
...全文
评论 4
收藏 已收藏
分享
返回顶部
xuuyaoo
系统维护与使用区 19,615 成员 74,556 内容