Hi Raffale,

because poor old commons-email (or at least me) was not aware of the feature :-)

I had a quick look 

* Sending a HTML file with embedded images (without DataSourceResolver) seems 
to work but the email is not properly displayed with all email clients. Does 
this 

* Do you have a working code snippet showing what you are doing? Or a Gist? 

Thanks in advance, 

Siegfried Goeschl


> On 07.12.2017, at 17:16, Raffaele Gambelli 
> <r.gambe...@hitachi-systems-cbt.com> wrote:
> 
> Hi Andreas,
> 
> yes I did! I did what I specified in my first email, so I did what, maybe, 
> would have to do commons email, identifying the encoded image, extracting its 
> bytes, decoding them, transforming them into ByteArrayDataSource (javamail) 
> and give it to the embed method, it worked but.... commons email why can't do 
> it for us?
> 
> Thanks Andreas, bye
> 
> Raffaele Gambelli
> WebRainbow® Software Analyst & Developer
> 
> Hitachi Systems CBT
> r.gambe...@hitachi-systems-cbt.com | Phone +39 051 8550 576
> Via Ettore Cristoni, 84 | 40033 Casalecchio Di Reno
> www.hitachi-systems-cbt.com
> 
> This email for the D.Lgs n.196/2003 (Privacy Code), may contain confidential 
> and/or privileged information for the sole use of the intended recipient. Any 
> review or distribution by others is strictly prohibited. If you are not the 
> intended recipient, you must not use, copy, disclose or take any action based 
> on this message or any information here. If you have received this email in 
> error, please contact us (e-mail: priv...@hitachi-systems-cbt.com) by reply 
> e-mail and delete all copies. Legal privilege is not waived because you have 
> read this e-mail. Thank you for your cooperation.
> 
> 
> -----Andreas Kuhtz <andreas.ku...@gmail.com> ha scritto: -----
> Per: Commons Users List <user@commons.apache.org>
> Da: Andreas Kuhtz <andreas.ku...@gmail.com>
> Data: 07/12/2017 05.03PM
> Oggetto: Re: [email] ImageHtmlEmail and base64 encoded image in html body 
> throws exception
> 
> Hi Raffaele,
> 
> I think the form "<img src="data:image/gif;base64,R0..." is currently not
> supported, that's why unknown protocol "data" is thrown. The "data" is the
> first part of the uri for src that you provided.
> 
> Have you tried to add the image as attachment and use the "cid" protocol as
> shown in the user guide?
> 
> Hope this helps.
> 
> Cheers,
> Andreas
> 
> 
> 2017-12-07 16:46 GMT+01:00 Raffaele Gambelli <
> r.gambe...@hitachi-systems-cbt.com>:
> 
>> Hi Martin,
>> 
>> have you read my question? Why are you continueing to talk about a
>> different matter, can I ask you to try to explain me, if you know it, if I
>> found a bug or not?
>> Saying differently, how do you send an email containing base64 encoded
>> images in its html?
>> 
>> Thanks, bye
>> 
>> Raffaele Gambelli
>> WebRainbow® Software Analyst & Developer
>> 
>> Hitachi Systems CBT
>> r.gambe...@hitachi-systems-cbt.com | Phone +39 051 8550 576
>> Via Ettore Cristoni, 84 | 40033 Casalecchio Di Reno
>> www.hitachi-systems-cbt.com
>> 
>> This email for the D.Lgs n.196/2003 (Privacy Code), may contain
>> confidential and/or privileged information for the sole use of the intended
>> recipient. Any review or distribution by others is strictly prohibited. If
>> you are not the intended recipient, you must not use, copy, disclose or
>> take any action based on this message or any information here. If you have
>> received this email in error, please contact us (e-mail:
>> priv...@hitachi-systems-cbt.com) by reply e-mail and delete all copies.
>> Legal privilege is not waived because you have read this e-mail. Thank you
>> for your cooperation.
>> 
>> 
>> -----Martin Gainty <mgai...@hotmail.com> ha scritto: -----
>> Per: Commons Users List <user@commons.apache.org>
>> Da: Martin Gainty <mgai...@hotmail.com>
>> Data: 07/12/2017 04.43PM
>> Oggetto: Re: [email] ImageHtmlEmail and base64 encoded image in html body
>> throws exception
>> 
>> break the rules at your own peril
>> 
>> 
>> bye
>> ______________________________________________
>> 
>> 
>> 
>> ________________________________
>> From: Raffaele Gambelli <r.gambe...@hitachi-systems-cbt.com>
>> Sent: Wednesday, December 6, 2017 10:43 AM
>> To: Commons Users List
>> Subject: Re: [email] ImageHtmlEmail and base64 encoded image in html body
>> throws exception
>> 
>> Hi Martin,
>> 
>> do you think that applying what you said resolves the exception Caused by:
>> java.net.MalformedURLException: unknown protocol: data ?
>> I think not...
>> 
>> Anyway thanks for your precision but passing null to DataSourceUrlResolver
>> works perfectly for "src" like http://www.apache.org/images/
>> asf_logo_wide.gif
>> 
>> [http://www.apache.org/images/asf_logo_wide.gif]
>> 
>> 
>> regards
>> 
>> Raffaele Gambelli
>> 
>> 
>> 
>> -----Martin Gainty <mgai...@hotmail.com> ha scritto: -----
>> Per: Commons Users List <user@commons.apache.org>
>> Da: Martin Gainty <mgai...@hotmail.com>
>> Data: 06/12/2017 03.52PM
>> Oggetto: Re: [email] ImageHtmlEmail and base64 encoded image in html body
>> throws exception
>> 
>> DataSourceUrlResolver image argument needs to be a URL (not null and not a
>> plain String)
>> 
>> 
>> 
>> DataSourceUrlResolver(final URL baseUrl)
>> 
>> M-
>> ________________________________
>> From: Raffaele Gambelli <r.gambe...@hitachi-systems-cbt.com>
>> Sent: Wednesday, December 6, 2017 8:19 AM
>> To: user@commons.apache.org
>> Subject: [email] ImageHtmlEmail and base64 encoded image in html body
>> throws exception
>> 
>> Hi all,
>> 
>> I would like to send emails with some given html, sometimes my html
>> contains base64 encoded images, I mean images like this
>> https://jsfiddle.net/casiano/xadvz/
>> [https://assets.servedby-buysellads.com/p/manage/asset/id/32052]<
>> https://jsfiddle.net/casiano/xadvz/>
>> 
>> base64 testing image - JSFiddle<https://jsfiddle.net/casiano/xadvz/>
>> jsfiddle.net
>> Test your JavaScript, CSS, HTML or CoffeeScript online with JSFiddle code
>> editor.
>> 
>> 
>> 
>> [https://assets.servedby-buysellads.com/p/manage/asset/id/32052]<
>> https://jsfiddle.net/casiano/xadvz/>
>> 
>> base64 testing image - JSFiddle<https://jsfiddle.net/casiano/xadvz/>
>> [https://assets.servedby-buysellads.com/p/manage/asset/id/32052]<
>> https://jsfiddle.net/casiano/xadvz/>
>> 
>> base64 testing image - JSFiddle<https://jsfiddle.net/casiano/xadvz/>
>> jsfiddle.net
>> Test your JavaScript, CSS, HTML or CoffeeScript online with JSFiddle code
>> editor.
>> 
>> 
>> 
>> jsfiddle.net
>> Test your JavaScript, CSS, HTML or CoffeeScript online with JSFiddle code
>> editor.
>> 
>> 
>> 
>> 
>> <img src="data:image/gif;base64,R0...............................
>> ...................
>> 
>> I'm using commons email 1.4 and when I send that html, using
>> email.setDataSourceResolver(new DataSourceUrlResolver(null));, I receive
>> this:
>> 
>> Caused by: java.net.MalformedURLException: unknown protocol: data
>>         at java.net.URL.<init>(URL.java:600)
>>         at java.net.URL.<init>(URL.java:490)
>>         at java.net.URL.<init>(URL.java:439)
>>         at org.apache.commons.mail.resolver.DataSourceUrlResolver.
>> createUrl(DataSourceUrlResolver.java:115)
>> 
>> I'm going to parse the html, finding those encoded img, decoding them to
>> obtain file and embedding it as suggested int he guide
>> https://commons.apache.org/proper/commons-email/userguide.html.
>> Commons Email &#8211; Examples<https://commons.apache.org/proper/commons-
>> email/userguide.html>
>> commons.apache.org
>> A simple text email. Our first example will create a basic email message
>> to "John Doe" and send it through your Google Mail (GMail) account.
>> 
>> 
>> 
>> 
>> Nevertheless it seems strange that commons email is not able to handle
>> with those inline images that are quite common in signatures, am I wrong?
>> Thanks and best regards
>> 
>> Raffaele Gambelli
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
>> For additional commands, e-mail: user-h...@commons.apache.org
>> 
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
>> For additional commands, e-mail: user-h...@commons.apache.org
>> 
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
>> For additional commands, e-mail: user-h...@commons.apache.org
>> 
>> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
> For additional commands, e-mail: user-h...@commons.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org

Reply via email to