commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marcio Carvalho <marw...@gmail.com>
Subject [Email] Problem embeding Inline images
Date Tue, 15 Sep 2009 00:28:40 GMT
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
=============================

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message