我有一个 smtp 服务器,用于通过 Red Hat 7.2 发送电子邮件。如果我在服务器上输入命令,邮件就会成功发送。但是,我尝试创建一个脚本来自动发送邮件,但失败了。我的脚本:
#!/bin/bash
(
echo "HELO server.com";
echo "MAIL FROM: [email protected]";
echo "RCPT TO: [email protected]";
echo "DATA";
echo "From: [email protected]";
echo "To: [email protected]";
echo "Subject: Test mail";
echo -e "\n";
echo "Ok.";
echo "Bye";
echo -e "\n\n.";
echo "QUIT";
) | /usr/bin/telnet smtp_server 25
我究竟做错了什么?