Stardust
Stardust

Reputation: 1125

Sending images by mail

I've written a mail that'll send emails with images as attachments. The images are displaying in yahoo and gmail. But hotmail is displaying a square grey box wherever there should be an image. The following is the code that builds the image. Of course I'm reffering to it in the mail using cid. Thanks a lot in advance.

l_embedImage = new MimeBodyPart();
l_dataSource = new FileDataSource(new File(l_imagesBaseDirectory + "/" + l_completeImagePath));
l_dataHandler = new DataHandler(l_dataSource);
l_embedImage.setDataHandler(l_dataHandler);
l_embedImage.setHeader("Content-ID", "<" + l_cid + ">");
l_embedImage.setHeader("Content-Type", "image/gif");
l_embedImage.setHeader("discrete-type","image");
l_embedImage.setHeader("content-transfer-encoding", "base64");
p_multipart.addBodyPart(l_embedImage);

Upvotes: 3

Views: 424

Answers (2)

Andrew Dyster
Andrew Dyster

Reputation: 2318

I was having troubles with delivering e-mails until I went through the steps to become a trusted mail server.

Check out step 4 ("Authenticate your outbound e-mail: Publish Sender Policy Framework (SPF) records") in the following URL: http://postmaster.msn.com/Guidelines.aspx

Upvotes: 2

Omar Al Kababji
Omar Al Kababji

Reputation: 1838

I think that hotmail doesn't load them automatically, the user should agree on this message first:

Attachments, pictures, and links in this message have been blocked for your safety. Show content

As usual Microsoft must complete programmers life ;)

Upvotes: 0

Related Questions