0

I'm trying to send an email with an inline image. I've set the Content-ID and added a <img src="cid:image1@myemail"> to my html. The image arrives properly as an attachment, but mail clients show a broken image.

What am I doing wrong? The full source of the message is below:

Return-Path: <igal@lucee.org>
Received: from 128.149.80.230
        by smtp.googlemail.com with ESMTPSA id i7sm9313707paf.9.2016.09.01.11.15.59
        for <igal@lucee.org>
        (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128);
        Thu, 01 Sep 2016 11:15:59 -0700 (PDT)
Date: Thu, 1 Sep 2016 11:15:54 -0700 (PDT)
From: igal@lucee.org
To: igal@lucee.org
Message-ID: <489410968.5.1472753755600.JavaMail.Admin@IS16>
Subject: [Test] LDEV-545 html 5.0.0.200
MIME-Version: 1.0
Content-Type: multipart/mixed; 
    boundary="----=_Part_4_247149912.1472753754816"
X-Mailer: Lucee Mail

------=_Part_4_247149912.1472753754816
Content-Type: multipart/alternative; 
    boundary="----=_Part_3_913848408.1472753754815"

------=_Part_3_913848408.1472753754815
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit

Text Message

------=_Part_3_913848408.1472753754815
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 7bit

Inline Image: <img src="cid:image1@myemail">

------=_Part_3_913848408.1472753754815--

------=_Part_4_247149912.1472753754816
Content-Type: image/jpeg; name=test-image.jpg
Content-Transfer-Encoding: base64
Content-Disposition: inline; filename=test-image.jpg
Content-ID: image1@myemail

/9j/4AAQSkZJRgABAQEAYABgAAD/4QBoRXhpZgAATU0AKgAAAAgABAEaAAUAAAABAAAAPgEbAAUA
AAABAAAARgEoAAMAAAABAAIAAAExAAIAAAARAAAATgAAAAAAAABgAAAAAQAAAGAAAAABcGFpbnQu
bmV0IDQuMC4xMAAA/9sAQwAKBwcJBwYKCQgJCwsKDA8ZEA8ODg8eFhcSGSQgJiUjICMiKC05MCgq
NisiIzJEMjY7PUBAQCYwRktFPko5P0A9/9sAQwELCwsPDQ8dEBAdPSkjKT09PT09PT09PT09PT09
P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+NAjAHaOSu38iauyeI0a50eHSNRjRZJooJdOMI82Nf4s55XAGOldlij
AznHPrUPGRl8cP6tbqn2XnvrqP2bWzOK0C+trfXtTim1xLd31SULYsYx5pOADyN3J9D2rtqTFLXP
XrKrLmSt/Xoi4x5VYKKKKwKCiiigAooooAKKKKACiiigAooooA//2Q==
------=_Part_4_247149912.1472753754816--
isapir
  • 17,680
  • 9
  • 99
  • 106
  • Would be a great idea to show what code you're using to send the email. – Darren Wainwright Sep 01 '16 at 18:25
  • The code is language specific and IMO is irrelevant. It is written in a JVM language and is translated to Java. The important part is the end result which I posted above. – isapir Sep 01 '16 at 18:27
  • Did you write it? Are you using a library to send an email? Are you sending email through an email program? There isn't enough information in what you have provided to say WHY it's being sent as an attachment. Sure, we can see your email content but that doesn't help figure WHY – Darren Wainwright Sep 01 '16 at 18:28
  • It's using several Java libraries. I believe that there is a bug somewhere, which I want to fix, so again -- the source code on my end is irrelevant. If someone with good knowledge of mime messages will look at the message he might know where the problem is. – isapir Sep 01 '16 at 18:30
  • Something on a related answer says to put your Content-ID value in <> - I.E `Content-ID: ` - see comments on answer here http://stackoverflow.com/questions/4018709/how-to-create-an-email-with-embedded-images-that-is-compatible-with-the-most-mai – Darren Wainwright Sep 01 '16 at 18:36
  • Yes, that might the right track. I sent myself an email from a regular mail client with the same attachment and I do see the angular brackets there. I need to test that, thanks. You can post that as an answer and if it is the issue then I will accept it after I confirm that. – isapir Sep 01 '16 at 18:42
  • That's ok thanks. I just guessed/googled; feel free to add and accept your own answer once you nail the issue. – Darren Wainwright Sep 01 '16 at 18:42

1 Answers1

0

I found the problem. It is missing Content-Type: multipart/related;

isapir
  • 17,680
  • 9
  • 99
  • 106