以下操作在命令行上按预期正常运行:
mail < /home/incoming/mailprocoutput.txt -s "Message Processing results..." -r [email protected] [email protected]
cat filename pipe mail 等在命令行上也能正常工作。但在 shell 脚本中使用时,这两种方法都会导致邮件正文为空:
#!/bin/bash
# This is to send an email from the mailproc python script with the results of message processing
timestamp=$( date +%T )
curDate=$( date +"%m-%d-%y" )
logger "Mailproc has run at $timestamp on $curDate, sending response back to the creator..."
mail < /home/incoming/mailprocoutput.txt -s "Message Processing results..." -r [email protected] [email protected]
exit
我做错了什么?Ubuntu 18.04,GNU mailutils 版本 3.4