You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Siegfried Goeschl (JIRA)" <ji...@apache.org> on 2010/07/03 15:31:50 UTC
[jira] Commented: (EMAIL-92) Improve support to embed images in
HTML eMails
[ https://issues.apache.org/jira/browse/EMAIL-92?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12884921#action_12884921 ]
Siegfried Goeschl commented on EMAIL-92:
----------------------------------------
I wrote a few additional tests to check if I can easily create an email from my Sonar installation which is currently not possible
Here the image markup from http://nemo.sonarsource.org/project/index/51834
"<img alt=\"Chart?ck=xradar&w=120&h=120&c=7fff00|7fff00&m=4&g=0\" src=\"/chart ck=xradar&w=120&h=120&c=7fff00|7fff00&m=4&g=0.2&l=A,C,S,T&v=3.0,3.0,2.0,2.0\"");
which should result in the following URL
http://nemo.sonarsource.org/chart?ck=xradar&w=120&h=120&c=7fff00|7fff00&m=4&g=0.2&l=A,C,S,T&v=3.0,3.0,2.0,2.0
but throws the following exception
SEVERE: Could not download URL: /chart?ck=xradar&w=120&h=120&c=7fff00|7fff00&m=4&g=0.2&l=A,C,S,T&v=3.0,3.0,2.0,2.0 Exception: no protocol: /chart?ck=xradar&w=120&h=120&c=7fff00|7fff00&m=4&g=0.2&l=A,C,S,T&v=3.0,3.0,2.0,2.0
Basically I see two problems
+) creating the correct URL
+) resolve the "&"
Can you get in touch with me since I'm working on a modified code base (I will attach it as patch)
> Improve support to embed images in HTML eMails
> ----------------------------------------------
>
> Key: EMAIL-92
> URL: https://issues.apache.org/jira/browse/EMAIL-92
> Project: Commons Email
> Issue Type: New Feature
> Reporter: Dominik Stadler
> Assignee: Siegfried Goeschl
> Attachments: EMAIL-92-with-test.patch, ImageHtmlEmail.java, ImageHtmlEmail.java
>
>
> I have created a improvement on top of HtmlEmail class which automatically detects <img src=".."/> tags in the HTML source and which embeds all the URLs correctly in the email so they are sent as attachments as part of the email.
> It is implemented as new class ImageHtmlEmail, no existing code of commons email is touched at all.
> This make sending HTML Mails much easier, now it is as simple as
> ImageHtmlEmail email = new ImageHtmlEmail();
> email.setHostName(SMTP_HOST);
> email.addTo(EMAIL_TO, "DS");
> email.setFrom(EMAIL_FROM, "Me");
> email.setSubject(EMAIL_SUBJECT);
>
> String html = FileUtils.readFileToString(new File("/tmp/test_email.html"));
>
> // set the html message
> email.setHtmlMsg(html, new File("/tmp"));
> // set the alternative message
> email.setTextMsg("Your email client does not support HTML messages");
> // send the email
> email.send();
> as stated in the mail, I am making this availalbe under the Apache License 2.0 so that it can be integrated if it sounds useful.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.