我需要发送html格式的电子邮件.我只有linux命令行和命令“mail”.目前已使用:echo To: address@example.com /var/www/report.csvecho Subject: Subject /var/www/report.csvecho Content-Type: text/h...
我需要发送html格式的电子邮件.我只有linux命令行和命令“mail”.
目前已使用:
echo "To: address@example.com" > /var/www/report.csv
echo "Subject: Subject" >> /var/www/report.csv
echo "Content-Type: text/html; charset=\"us-ascii\"" >> /var/www/report.csv
echo "<html>" >> /var/www/report.csv
mysql -u ***** -p***** -H -e "select * from users LIMIT 20" dev >> /var/www/report.csv
echo "</html>" >> /var/www/report.csv
mail -s "Built notification" address@example.com < /var/www/report.csv
但在我的邮件代理中我只得到普通/文本.
解决方法:
这对我有用:
echo "<b>HTML Message goes here</b>" | mail -s "$(echo -e "This is the subject\nContent-Type: text/html")" foo@example.com
编程基础网
本文标题为:如何使用linux命令行发送HTML电子邮件
基础教程推荐
猜你喜欢
- 详解CSS开发过程中的20个快速提升技巧 2022-11-16
- Ajax请求过程中下载文件在FireFox(火狐)浏览器下的兼容问题 2022-12-18
- Vue常见面试题(持续更新中...) 2023-10-08
- JavaScrip简单数据类型隐式转换的实现 2023-07-10
- 使用prerender-spa-plugin实现vue预渲染 2023-10-08
- VUE编写可复用性模块 2023-10-08
- 使用Nginx 反向代理来避免 ajax 跨域请求的方法 2023-01-20
- 解决方案:uni-app非nvue模式下切换主题后,App端闪屏、闪白、闪黑、状态栏主题色不稳定 2023-10-08
- Ajax加载菊花loding效果 2023-01-20
- vue-cli4 配置gzip 2023-10-08
