从控制台优先发送邮件

从控制台优先发送邮件

如何从标有“高优先级”标志的控制台发送邮件?

目前我正在使用这个语法:

echo "message content" | mail -s "subject" [email protected]

我没有看到任何有关此的开关man

答案1

你能使用 吗sendmail?如果可以:

mymachine $ sendmail [email protected] <<EOM
> To: [email protected]
> From: [email protected]
> Subject: Test mail `date +"%x %H:%M"`
> Importance: high    
> X-Priority: 1 (Highest)
> X-MSMail-Priority: High
> 
> Test message
> EOM

mymachine $

后面的文本>将在换行符处输入。当然,您也可以直接通过管道传输文本文件:

mymachine $ cat > message
> To: [email protected]
> From: [email protected]
> Subject: Test mail `date +"%x %H:%M"`
> Importance: high
> X-Priority: 1 (Highest)
> X-MSMail-Priority: High
> 
> Test message
## CTRL+D ##

mymachine $ cat message | sendmail [email protected]

相关内容