使用linux命令在电子邮件中嵌入图像 [英] Embeding an image in an email using linux commands

查看:157
本文介绍了使用linux命令在电子邮件中嵌入图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法使用linux命令(如mutt或发送邮件)将图像嵌入邮件正文中?

我使用这个
mutt -e' set content_type =text / image'u.mohan@6dtech.co.in -sTEST-i image001.jpg< data.txt
但它不工作
请帮助



如果它不可能使用linux然后帮助我一个代码在java

解决方案

对于那些希望使用bash脚本发送带有嵌入图像的电子邮件作为电子邮件的一部分的人,我将此代码拼凑在一起。



电子邮件以以下行开始:

  EMAILBODY =回声\闹钟熄灭了! 
EMAILATTACH =

定义每个要附加的文件的循环内: / p>

  EMAILATTACH = $ EMAILATTACH-a / home / xyz /$ ID/$ Event/$ Frame capture.jpg
EMAILBODY = $ EMAILBODY< BR> < IMG Height = 150 SRC = \$ Frame-capture.jpg\>

循环后,电子邮件将完成以下行:

  EMAILBODY = $ EMAILBODY\| mutt -e \set content_type = text / html\-s \House Alarm已关闭!\
EMAILSTRING = $ EMAILBODY $ EMAILATTACH - user@server.net
eval $ EMAILSTRING

我的最后一个障碍是当我在Android手机上收到这个(可能在其他浏览器),它不显示图片,只有一个小盒子(即使你已经下载了附件)。它在Outlook中显示良好。


is there a way to embed images into the body of an email using linux commands like mutt or send mail

i used this mutt -e 'set content_type="text/image"' u.mohan@6dtech.co.in -s "TEST" -i image001.jpg < data.txt but its not working please help

if its not possible using linux then help me with a code in java

解决方案

For those looking to send emails with embedded images as part of the email using a bash script, I pieced this code together.

The email is started with these line:

EMAILBODY="echo \"Alarm went off! "
EMAILATTACH=""

Inside of a loop that defines each file to attach:

EMAILATTACH=$EMAILATTACH" -a /home/xyz/"$ID"/"$Event"/"$Frame"-capture.jpg"
EMAILBODY=$EMAILBODY"<BR> <IMG Height=150 SRC=\"$Frame-capture.jpg\">"

After the loop, the email is completed with these lines:

EMAILBODY=$EMAILBODY"\" | mutt -e \"set content_type=text/html\" -s \"House Alarm went off!\""
EMAILSTRING=$EMAILBODY$EMAILATTACH" -- user@server.net"
eval $EMAILSTRING

My last hurdle is that when I receive this on my android phone (maybe the same on other browsers), it doesn't display the picture, only a small box (even after you have downloaded the attachments). It shows up fine in Outlook though.

这篇关于使用linux命令在电子邮件中嵌入图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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