You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Marcio Carvalho <ma...@gmail.com> on 2009/09/15 02:28:40 UTC

[Email] Problem embeding Inline images

Hi all,

I'm experiencing some problems trying to embed images in my emails.
I use commons-email-1.1. I have the following code:

*HtmlEmail email = new HtmlEmail();

email.setCharset("ISO-8859-1");
email.setHostName(EMAIL_SERVER);
email.addTo(x, y);
email.setFrom("system@domain", "ACME");
email.setSubject(suvject);

String cid = email.embed("myFile.jpg");
String body = "<html>MyFile - <img src=\"cid:"+cid+"\"></html>"

email.setHtmlMsg(body);
email.send();
*
So. The email is correctly sent and my images are correctly attached. But
the email is not correctly rendered by any of my email clients. Neither
Lotus Notes nor Gmail.

Checking the email header and payload, everything looks ok. The references
are made thru "cid" and the "cids" are correctly generated (I guess).

All the email formatting is done ok, but the images are not shown in the
correct positions. At Gmail, all the images are shown as regular attachment,
not inline images.

Please, have a look at my original email below and tell me if I am doing
something wrong.

Any help would be appreciated.

Regards,

Marcio Carvalho.

--- Some parts omitted ----

MIME-Version: 1.0
X-MIMETrack: Itemize by SMTP Server on (XXXX) at 14/09/2009 14:59:11,
Serialize by Router on YYYYY(Release 8.0.2FP1 HF386|May 28, 2009) at
14/09/2009 14:59:15
Content-Type: multipart/related;
	boundary="----=_Part_123_81622377.1252951151420"

------=_Part_123_81622377.1252951151420
Content-Type: multipart/alternative;
	boundary="----=_Part_124_81624107.1252951151420"

------=_Part_124_81624107.1252951151420
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html; charset=ISO-8859-1

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.=w3.org/TR/html4/loose.dtd">
<html xmlns=3D'http://www.w3.org/1999/xhtml'>
<head>
<style type='text/css'>
*, body {
background: url("cid:snbjfupfwj") no-repeat top;
position: relative;

}

...

</html>

------=_Part_124_81624107.1252951151420--

------=_Part_123_81622377.1252951151420
Content-Type: image/jpeg; name=header.jpg
Content-Disposition: inline; filename=header.jpg
Content-ID: <snbjfupfwj>
Content-Transfer-Encoding: base64


/9j/4AAQSkZJRgABAQEASABIAAD/4QkdRXhpZgAASUkqAAgAAAADABoBBQABAAAAMgAAABsBBQAB
AAAAOgAAACgBAwABAAAAAgAAAEIAAABIAAAAAQAAAEgAAAABAAAABgADAQMAAQAAAAYAAAAaAQUA
AQAAAJAAAAAbAQUAAQAAAJgAAAAoAQMAAQAAAAIAAAABAgQAAQAAAKAAAAACAgQAAQAAAHUIAAAA
AAAASAAAAAEAAABIAAAAAQAAAP/Y/+AAEEpGSUYAAQEBAEgASAAA/9sAQwAGBAUGBQQGBgUGBwcG
CAoQCgoJCQoUDg8MEBcUGBgXFBYWGh0lHxobIxwWFiAsICMmJykqKRkfLTAtKDAlKCko/9sAQwEH

...


-- 
"Do or do not. There is no try."  (Master Yoda)
=============================
          Marcio Ribeiro de Carvalho
              marweck@gmail.com
    marcio.carvalho@petrobras.com.br
=============================

Re: [Email] Problem embeding Inline images

Posted by Siegfried Goeschl <si...@it20one.at>.
Hi Marcio,

please have a look at
http://people.apache.org/builds/commons/email/1.2/RC2/staged/commons-email/commons-email/1.2/


It contains the latest release candidate before SVN infrastructure
problems and project pressure stopped my release effort.

Cheers,

Siegfried Goeschl

Marcio Carvalho wrote:
> I couldn't connect to Apache SVN server.
>
> I tried http://svn.apache.org/repos/asf/commons/proper/email/trunk
>
> The error was "RA layer request failed".
>
> Thanks.
>
> Marcio
>
> On Tue, Sep 15, 2009 at 2:40 PM, Siegfried Goeschl
> <si...@it20one.at> wrote:
>   
>> Hi Marcio,
>>
>> a lot of this problems (if not all) have been fixed in the current main
>> branch - can you have it a try?
>>
>> Cheers,
>>
>> Siegfried Goeschl
>>
>> Marcio Carvalho wrote:
>>     
>>> Hi all,
>>>
>>> I'm experiencing some problems trying to embed images in my emails.
>>> I use commons-email-1.1. I have the following code:
>>>
>>> *HtmlEmail email = new HtmlEmail();
>>>
>>> email.setCharset("ISO-8859-1");
>>> email.setHostName(EMAIL_SERVER);
>>> email.addTo(x, y);
>>> email.setFrom("system@domain", "ACME");
>>> email.setSubject(suvject);
>>>
>>> String cid = email.embed("myFile.jpg");
>>> String body = "<html>MyFile - <img src=\"cid:"+cid+"\"></html>"
>>>
>>> email.setHtmlMsg(body);
>>> email.send();
>>> *
>>> So. The email is correctly sent and my images are correctly attached. But
>>> the email is not correctly rendered by any of my email clients. Neither
>>> Lotus Notes nor Gmail.
>>>
>>> Checking the email header and payload, everything looks ok. The references
>>> are made thru "cid" and the "cids" are correctly generated (I guess).
>>>
>>> All the email formatting is done ok, but the images are not shown in the
>>> correct positions. At Gmail, all the images are shown as regular attachment,
>>> not inline images.
>>>
>>> Please, have a look at my original email below and tell me if I am doing
>>> something wrong.
>>>
>>> Any help would be appreciated.
>>>
>>> Regards,
>>>
>>> Marcio Carvalho.
>>>
>>> --- Some parts omitted ----
>>>
>>> MIME-Version: 1.0
>>> X-MIMETrack: Itemize by SMTP Server on (XXXX) at 14/09/2009 14:59:11,
>>> Serialize by Router on YYYYY(Release 8.0.2FP1 HF386|May 28, 2009) at
>>> 14/09/2009 14:59:15
>>> Content-Type: multipart/related;
>>>       boundary="----=_Part_123_81622377.1252951151420"
>>>
>>> ------=_Part_123_81622377.1252951151420
>>> Content-Type: multipart/alternative;
>>>       boundary="----=_Part_124_81624107.1252951151420"
>>>
>>> ------=_Part_124_81624107.1252951151420
>>> Content-Transfer-Encoding: quoted-printable
>>> Content-Type: text/html; charset=ISO-8859-1
>>>
>>> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
>>> "http://www.=w3.org/TR/html4/loose.dtd">
>>> <html xmlns=3D'http://www.w3.org/1999/xhtml'>
>>> <head>
>>> <style type='text/css'>
>>> *, body {
>>> background: url("cid:snbjfupfwj") no-repeat top;
>>> position: relative;
>>>
>>> }
>>>
>>> ...
>>>
>>> </html>
>>>
>>> ------=_Part_124_81624107.1252951151420--
>>>
>>> ------=_Part_123_81622377.1252951151420
>>> Content-Type: image/jpeg; name=header.jpg
>>> Content-Disposition: inline; filename=header.jpg
>>> Content-ID: <snbjfupfwj>
>>> Content-Transfer-Encoding: base64
>>>
>>>
>>> /9j/4AAQSkZJRgABAQEASABIAAD/4QkdRXhpZgAASUkqAAgAAAADABoBBQABAAAAMgAAABsBBQAB
>>> AAAAOgAAACgBAwABAAAAAgAAAEIAAABIAAAAAQAAAEgAAAABAAAABgADAQMAAQAAAAYAAAAaAQUA
>>> AQAAAJAAAAAbAQUAAQAAAJgAAAAoAQMAAQAAAAIAAAABAgQAAQAAAKAAAAACAgQAAQAAAHUIAAAA
>>> AAAASAAAAAEAAABIAAAAAQAAAP/Y/+AAEEpGSUYAAQEBAEgASAAA/9sAQwAGBAUGBQQGBgUGBwcG
>>> CAoQCgoJCQoUDg8MEBcUGBgXFBYWGh0lHxobIxwWFiAsICMmJykqKRkfLTAtKDAlKCko/9sAQwEH
>>>
>>> ...
>>>
>>>
>>>
>>>       
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
>> For additional commands, e-mail: user-help@commons.apache.org
>>
>>     
>
>
>
> --
> "Do or do not. There is no try."  (Master Yoda)
> =============================
>           Marcio Ribeiro de Carvalho
>               marweck@gmail.com
>     marcio.carvalho@petrobras.com.br
> =============================
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
>
>
>
>   

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


Re: [Email] Problem embeding Inline images

Posted by Marcio Carvalho <ma...@gmail.com>.
I couldn't connect to Apache SVN server.

I tried http://svn.apache.org/repos/asf/commons/proper/email/trunk

The error was "RA layer request failed".

Thanks.

Marcio

On Tue, Sep 15, 2009 at 2:40 PM, Siegfried Goeschl
<si...@it20one.at> wrote:
>
> Hi Marcio,
>
> a lot of this problems (if not all) have been fixed in the current main
> branch - can you have it a try?
>
> Cheers,
>
> Siegfried Goeschl
>
> Marcio Carvalho wrote:
> > Hi all,
> >
> > I'm experiencing some problems trying to embed images in my emails.
> > I use commons-email-1.1. I have the following code:
> >
> > *HtmlEmail email = new HtmlEmail();
> >
> > email.setCharset("ISO-8859-1");
> > email.setHostName(EMAIL_SERVER);
> > email.addTo(x, y);
> > email.setFrom("system@domain", "ACME");
> > email.setSubject(suvject);
> >
> > String cid = email.embed("myFile.jpg");
> > String body = "<html>MyFile - <img src=\"cid:"+cid+"\"></html>"
> >
> > email.setHtmlMsg(body);
> > email.send();
> > *
> > So. The email is correctly sent and my images are correctly attached. But
> > the email is not correctly rendered by any of my email clients. Neither
> > Lotus Notes nor Gmail.
> >
> > Checking the email header and payload, everything looks ok. The references
> > are made thru "cid" and the "cids" are correctly generated (I guess).
> >
> > All the email formatting is done ok, but the images are not shown in the
> > correct positions. At Gmail, all the images are shown as regular attachment,
> > not inline images.
> >
> > Please, have a look at my original email below and tell me if I am doing
> > something wrong.
> >
> > Any help would be appreciated.
> >
> > Regards,
> >
> > Marcio Carvalho.
> >
> > --- Some parts omitted ----
> >
> > MIME-Version: 1.0
> > X-MIMETrack: Itemize by SMTP Server on (XXXX) at 14/09/2009 14:59:11,
> > Serialize by Router on YYYYY(Release 8.0.2FP1 HF386|May 28, 2009) at
> > 14/09/2009 14:59:15
> > Content-Type: multipart/related;
> >       boundary="----=_Part_123_81622377.1252951151420"
> >
> > ------=_Part_123_81622377.1252951151420
> > Content-Type: multipart/alternative;
> >       boundary="----=_Part_124_81624107.1252951151420"
> >
> > ------=_Part_124_81624107.1252951151420
> > Content-Transfer-Encoding: quoted-printable
> > Content-Type: text/html; charset=ISO-8859-1
> >
> > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
> > "http://www.=w3.org/TR/html4/loose.dtd">
> > <html xmlns=3D'http://www.w3.org/1999/xhtml'>
> > <head>
> > <style type='text/css'>
> > *, body {
> > background: url("cid:snbjfupfwj") no-repeat top;
> > position: relative;
> >
> > }
> >
> > ...
> >
> > </html>
> >
> > ------=_Part_124_81624107.1252951151420--
> >
> > ------=_Part_123_81622377.1252951151420
> > Content-Type: image/jpeg; name=header.jpg
> > Content-Disposition: inline; filename=header.jpg
> > Content-ID: <snbjfupfwj>
> > Content-Transfer-Encoding: base64
> >
> >
> > /9j/4AAQSkZJRgABAQEASABIAAD/4QkdRXhpZgAASUkqAAgAAAADABoBBQABAAAAMgAAABsBBQAB
> > AAAAOgAAACgBAwABAAAAAgAAAEIAAABIAAAAAQAAAEgAAAABAAAABgADAQMAAQAAAAYAAAAaAQUA
> > AQAAAJAAAAAbAQUAAQAAAJgAAAAoAQMAAQAAAAIAAAABAgQAAQAAAKAAAAACAgQAAQAAAHUIAAAA
> > AAAASAAAAAEAAABIAAAAAQAAAP/Y/+AAEEpGSUYAAQEBAEgASAAA/9sAQwAGBAUGBQQGBgUGBwcG
> > CAoQCgoJCQoUDg8MEBcUGBgXFBYWGh0lHxobIxwWFiAsICMmJykqKRkfLTAtKDAlKCko/9sAQwEH
> >
> > ...
> >
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
>



--
"Do or do not. There is no try."  (Master Yoda)
=============================
          Marcio Ribeiro de Carvalho
              marweck@gmail.com
    marcio.carvalho@petrobras.com.br
=============================

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


Re: [Email] Problem embeding Inline images

Posted by Siegfried Goeschl <si...@it20one.at>.
Hi Marcio,

a lot of this problems (if not all) have been fixed in the current main
branch - can you have it a try?

Cheers,

Siegfried Goeschl

Marcio Carvalho wrote:
> Hi all,
>
> I'm experiencing some problems trying to embed images in my emails.
> I use commons-email-1.1. I have the following code:
>
> *HtmlEmail email = new HtmlEmail();
>
> email.setCharset("ISO-8859-1");
> email.setHostName(EMAIL_SERVER);
> email.addTo(x, y);
> email.setFrom("system@domain", "ACME");
> email.setSubject(suvject);
>
> String cid = email.embed("myFile.jpg");
> String body = "<html>MyFile - <img src=\"cid:"+cid+"\"></html>"
>
> email.setHtmlMsg(body);
> email.send();
> *
> So. The email is correctly sent and my images are correctly attached. But
> the email is not correctly rendered by any of my email clients. Neither
> Lotus Notes nor Gmail.
>
> Checking the email header and payload, everything looks ok. The references
> are made thru "cid" and the "cids" are correctly generated (I guess).
>
> All the email formatting is done ok, but the images are not shown in the
> correct positions. At Gmail, all the images are shown as regular attachment,
> not inline images.
>
> Please, have a look at my original email below and tell me if I am doing
> something wrong.
>
> Any help would be appreciated.
>
> Regards,
>
> Marcio Carvalho.
>
> --- Some parts omitted ----
>
> MIME-Version: 1.0
> X-MIMETrack: Itemize by SMTP Server on (XXXX) at 14/09/2009 14:59:11,
> Serialize by Router on YYYYY(Release 8.0.2FP1 HF386|May 28, 2009) at
> 14/09/2009 14:59:15
> Content-Type: multipart/related;
> 	boundary="----=_Part_123_81622377.1252951151420"
>
> ------=_Part_123_81622377.1252951151420
> Content-Type: multipart/alternative;
> 	boundary="----=_Part_124_81624107.1252951151420"
>
> ------=_Part_124_81624107.1252951151420
> Content-Transfer-Encoding: quoted-printable
> Content-Type: text/html; charset=ISO-8859-1
>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
> "http://www.=w3.org/TR/html4/loose.dtd">
> <html xmlns=3D'http://www.w3.org/1999/xhtml'>
> <head>
> <style type='text/css'>
> *, body {
> background: url("cid:snbjfupfwj") no-repeat top;
> position: relative;
>
> }
>
> ...
>
> </html>
>
> ------=_Part_124_81624107.1252951151420--
>
> ------=_Part_123_81622377.1252951151420
> Content-Type: image/jpeg; name=header.jpg
> Content-Disposition: inline; filename=header.jpg
> Content-ID: <snbjfupfwj>
> Content-Transfer-Encoding: base64
>
>
> /9j/4AAQSkZJRgABAQEASABIAAD/4QkdRXhpZgAASUkqAAgAAAADABoBBQABAAAAMgAAABsBBQAB
> AAAAOgAAACgBAwABAAAAAgAAAEIAAABIAAAAAQAAAEgAAAABAAAABgADAQMAAQAAAAYAAAAaAQUA
> AQAAAJAAAAAbAQUAAQAAAJgAAAAoAQMAAQAAAAIAAAABAgQAAQAAAKAAAAACAgQAAQAAAHUIAAAA
> AAAASAAAAAEAAABIAAAAAQAAAP/Y/+AAEEpGSUYAAQEBAEgASAAA/9sAQwAGBAUGBQQGBgUGBwcG
> CAoQCgoJCQoUDg8MEBcUGBgXFBYWGh0lHxobIxwWFiAsICMmJykqKRkfLTAtKDAlKCko/9sAQwEH
>
> ...
>
>
>   

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