我一直在尝试通过在 Linux 服务器上从 mailx 发送 html 电子邮件来工作。
几点注意事项:
对于我的案例,我在关于 stackoverflow 的大多数帖子中看到的内容:
mailx -v -S smtp=SERVER -s "$(echo -e "This is the subject\nContent-Type: text/html")" -r FROM TO < htmlmail.txt
Run Code Online (Sandbox Code Playgroud)
在我的情况下,这只是返回一个纯文本电子邮件。
所以这是我迄今为止尝试过的:
尝试 1:
我在帖子中看到添加 Content-Disposition: inline。
mailx -v -S smtp=SERVER -s "$(echo -e "This is the subject v1\nContent-Type: text/html\nMIME-Version: 1.0\nContent-Disposition: inline")" -r FROM TO < htmlmail.txt
Run Code Online (Sandbox Code Playgroud)
这最终会发送一封 html 电子邮件,但由于标题包含在正文中,因此它输出如下:
内容处置:内联消息 …