我想从命令行快速发送电子邮件,我意识到可能有很多不同的方法来做到这一点。
我正在寻找一种从Linux终端(可能是bash shell,但任何应该做的事情)来实现这一目的简单方法,以及在Windows上实现此操作的另一种方法。我希望能够在命令行上直接编写一封电子邮件,或者能够灵活地将消息传送到命令行程序中。
发布于 2018-05-30 15:03:39
可以使用邮件:
$mail -s <subject> <recipients>
然后键入消息并以只有句点的行结尾。这意味着已经完成并发送消息。
也可以从STDIN发送您的电子邮件,它将作为电子邮件的文本发送:
$<mail-generating-program> | mail -s <subject> <recipients>
使用这种方法的一个小注意事项-除非您的计算机连接到Internet,并且DNS设置正确,否则你将无法接收到对你的邮件的回复。
发布于 2018-05-30 15:53:02
$ echo "This is the email body" | mail -s "This is the subject" me@email.com
另一种选择是:
$ cat | mail -s "A few lines off the top of my head" me@here.com
This is where my
multiline
message would go
^D
^D-表示按下ctrl+d
https://stackoverflow.com/questions/-100000153
复制相似问题