使用HTML正文发送电子邮件并使用mailx附加附件 [英] Sending email with HTML body and attachement with mailx

查看:125
本文介绍了使用HTML正文发送电子邮件并使用mailx附加附件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在使用mailx从脚本中发送html格式的邮件:

I'm currently using mailx to send html formated mails from my scripts :

cat body.html | /usr/bin/mailx -a "From: Me <me@domain>" -a "Content-type: text/html" -s "My subject" $RECIPIENTS

现在,我想添加一个附件(png图像),但是我不知道该怎么做.我想先尝试使用mailx,然后再转向mutt或其他工具.非常感谢

Now I'd like to add an attachement (png image) but I cannot figure out how. I'd like to try with mailx before moving to mutt or something else. Thanks a lot

推荐答案

尝试一下:

uuncode input_file2.jpg attachment2.jpg >>tempfile
cat tempfile | mailx -s "subject" <email>

Uuencode读取文件(或默认情况下为标准输入),并将编码后的版本写入标准输出.编码仅使用打印ASCII字符,并包括文件的模式和uudecode使用的操作数名称.如果名称为/dev/stdout,则结果将被写入标准输出.默认情况下,将使用标准的UU编码格式.如果在命令行上给选项-m,则​​使用base64编码.

Uuencode reads file (or by default the standard input) and writes an encoded version to the standard output. The encoding uses only printing ASCII characters and includes the mode of the file and the operand name for use by uudecode. If name is /dev/stdout the result will be written to standard output. By default the standard UU encoding format will be used. If the option -m is given on the command line base64 encoding is used instead.

这篇关于使用HTML正文发送电子邮件并使用mailx附加附件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆