我们在发送邮件的时候,如果使用HTML在邮件内容中嵌入图片,<img src='。。。'/>,这经常会被邮件客户端软件或者网页阻止显示,这主要也是安全方面的考虑。
但其实我们也可以直接将图片本身直接嵌在邮件内容中,而是用 Commons-Email 可以轻松完成这个功能。
public static void SendPwdResetMail(String email, String account, String resetKey) {
try {
HtmlEmail body = _NewMailInstance(Arrays.asList(email));
body.setSubject("ddddddddddd");
File logo = new File(rootPath+"img"+File.separator+"logo.gif");
String cid = body.embed(logo, "image file");
body.setHtmlMsg("ddddddddddddddd<img src=""+cid
+"" alt="hhhhh" border="0"/>");
body.send();
} catch (EmailException e) {
throw new RuntimeException("Unabled to send mail", e);
}
}
分享到:
相关推荐
赠送jar包:commons-email-1.5.jar; 赠送原API文档:commons-email-1.5-javadoc.jar; 赠送源代码:commons-email-1.5-sources.jar; 赠送Maven依赖信息文件:commons-email-1.5.pom; 包含翻译后的API文档:...
基于Java调用邮件系统所需要的jar包,commons-email-1.5.jar,javax.mail-1.4.5.jar,activation.jar
用 apache commons email 发送带附件,HTML 格式的 邮件 格式例子 还包括commons-email的jar包,及其他相关资料
集成邮件发送所需要的四个jar包,activation.jar、additionnal.jar、commons-email-1.4.jar、mail.jar
1)将文件放入libs后,在gradle文件里加入implementation files('libs/commons-email-1.5.jar') 2)android收发邮件会要求引入此jar包
commons-email-1.5-src.zip 借助commons-email简化发送邮件的过程
邮件开发包,email包,是开发web常用包
jar包大小:135KB commons-validator-1.3.1.jar jar包大小:93KB commons-transaction-1.2.jar jar包大小:141KB commons-scxml-0.6.jar jar包大小:254KB commons-primitives-1.0.jar jar包大小:60KB commons-pool-1.3....
commons-email-1.4.jarcommons-email-1.4.jarcommons-email-1.4.jar
赠送jar包:commons-email-1.5.jar; 赠送原API文档:commons-email-1.5-javadoc.jar; 赠送源代码:commons-email-1.5-sources.jar; 赠送Maven依赖信息文件:commons-email-1.5.pom; 包含翻译后的API文档:...
包含邮件发送的jar包,同时添加实现过程文章的连接,个人觉着操作简单,可以轻松实现邮件发送功能。啦啦啦啦啦啦啦啦啦
NULL 博文链接:https://shuaigg-babysky.iteye.com/blog/355128
开发工具 commons-fileupload-1.3.2开发工具 commons-fileupload-1.3.2开发工具 commons-fileupload-1.3.2开发工具 commons-fileupload-1.3.2开发工具 commons-fileupload-1.3.2开发工具 commons-fileupload-1.3.2...
NULL 博文链接:https://liangq.iteye.com/blog/1222307
Java发送邮件所需要的几个JAR包,打包发给大家,包含以下内容: commons-email-1.1.jar mail.jar additionnal.jar activation.jar
commons-email-1.4
赠送jar包:commons-net-3.8.0.jar; 赠送原API文档:commons-net-3.8.0-javadoc.jar; 赠送源代码:commons-net-3.8.0-sources.jar; 赠送Maven依赖信息文件:commons-net-3.8.0.pom; 包含翻译后的API文档:...
activation.jar commons-email-1.2.jar mail.jar免费下载
javamail&commons-email 发送邮件的类库