Search The ForumSearch   RegisterRegister  LoginLogin

MailBee.NET SMTP

 AfterLogic Forum : MailBee.NET SMTP
Subject Topic: Sending Emails with INLINE Images Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
hmuscroft
Groupie
Groupie


Joined: 29 December 2009
Location: United Kingdom
Online Status: Offline
Posts: 72
Posted: 18 February 2017 at 9:27am | IP Logged Quote hmuscroft

Hi - I'm running into a problem when sending an email with INLINE images.

Specifically, the problem only manifests when sending to GMAIL or HOTMAIL accounts and when recipients are using their webmail interface to view these messages.

Here's how my app works :-

[1] I create emails in my app using the DevExpress XtraRichEdit Control
[2] I export the email body to HTML
[3] I set up the MailBee MailMessage FROM/TO/SUBJECT etc. and set the BODY like this :-
Code:
m_mailMessage.BodyHtmlText = HTML;
m_mailMessage.MakePlainBodyFromHtmlBody();

[4] I send the email

Here's a visual summary of the results...

(a) Screenshot of my app showing the email :-
http://pioneersoftware.co.uk/files/temp/email1.jpg

(b) Screenshot of the exported email HTML body (being viewed in FireFox) :-
http://pioneersoftware.co.uk/files/temp/email2.jpg

(c) Link to the actual HTML source so you can see the HTML being output :-
http://pioneersoftware.co.uk/files/temp/email_html_content.txt

(d) Screenshot showing how GMAIL receives this email :-
http://pioneersoftware.co.uk/files/temp/email3.jpg


Bizarrely - if I connect to the receiving GMAIL account using an Email Client (even my own Email Client written with your excellent components), then I can see the image!

However, both GMAIL and HOTMAIL webmail clients won't show inline images.

Please can you tell me what I'm doing wrong and how I can get these images to show in GMAIL/HOTMAIL's web client?

Many thanks,

Hedley
Back to Top View hmuscroft's Profile Search for other posts by hmuscroft
 
Alex
AfterLogic Support
AfterLogic Support
Avatar

Joined: 19 November 2003
Online Status: Offline
Posts: 2158
Posted: 18 February 2017 at 10:30am | IP Logged Quote Alex

What is the format of images? Maybe it's not web-enabled format like .bmp? Only .png and .jpg will work with web clients.

Regards,
Alex
Back to Top View Alex's Profile Search for other posts by Alex
 
hmuscroft
Groupie
Groupie


Joined: 29 December 2009
Location: United Kingdom
Online Status: Offline
Posts: 72
Posted: 21 February 2017 at 2:52am | IP Logged Quote hmuscroft

Sorry for the late reply. The image was a standard PNG file.
Back to Top View hmuscroft's Profile Search for other posts by hmuscroft
 
hmuscroft
Groupie
Groupie


Joined: 29 December 2009
Location: United Kingdom
Online Status: Offline
Posts: 72
Posted: 21 February 2017 at 2:56am | IP Logged Quote hmuscroft

Just further to that, if you look at the actual email content (linked in my original post) :-
http://pioneersoftware.co.uk/files/temp/email_html_content.txt

... then you'll see the image encoding in the email source is :-
<img src="data:image/png;base64...
Back to Top View hmuscroft's Profile Search for other posts by hmuscroft
 
Igor
AfterLogic Support
AfterLogic Support


Joined: 24 June 2008
Location: United States
Online Status: Offline
Posts: 5722
Posted: 21 February 2017 at 3:09am | IP Logged Quote Igor

Quote:
... then you'll see the image encoding in the email source is :-
<img src="data:image/png;base64...


While that's a correct way of supplying inline images, it doesn't seem to be universally recognized yet. Gmail, for instance, is reported to have no support of it.

If you have control over creating HTML, we'd recommend to supply inline images as attachments with their Content-IDs referenced in img src, the way it's done here for example.

--
Regards,
Igor, AfterLogic Support
Back to Top View Igor's Profile Search for other posts by Igor
 
hmuscroft
Groupie
Groupie


Joined: 29 December 2009
Location: United Kingdom
Online Status: Offline
Posts: 72
Posted: 21 February 2017 at 11:31am | IP Logged Quote hmuscroft

Excellent - that helped me to get it sorted thanks!
Back to Top View hmuscroft's Profile Search for other posts by hmuscroft
 
Deantwo
Newbie
Newbie
Avatar

Joined: 10 January 2018
Location: Denmark
Online Status: Offline
Posts: 5
Posted: 10 January 2018 at 2:18am | IP Logged Quote Deantwo

I am currently battling with this issue as well.
Found this article about the "issue": https://www.campaignmonitor.com/blog/email-marketing/2013/02/embedded-images-in-html-email/

Given the age of the article and the fact that Microsoft Outlook 2013 and Gmail still doesn't support inline images I am starting to fear that it is intended on their part.

My issue is that I get the HTML from another source. So I can't add the images as attachments with their Content-IDs, unless I manually read the HTML and read the image out into a stream.

I was kind of hoping that Mailbee.NET would be able to automatically convert inline images to attached files with Content-IDs.
Is there any tools that can do this?
Back to Top View Deantwo's Profile Search for other posts by Deantwo
 
Alex
AfterLogic Support
AfterLogic Support
Avatar

Joined: 19 November 2003
Online Status: Offline
Posts: 2158
Posted: 10 January 2018 at 2:30am | IP Logged Quote Alex

So you basically need to extract base64 blocks from your HTML and convert them into separate attachments?

No, there is no built-in method for this. However, it shouldn't be difficult to write this code directly in your app as it's just string processing:
- find base64-encoded image sequence
- replace it with a cid
- decode its base64 block (Convert.FromBase64String)
- add attachment using msg.Attachments.Add(byte[] data,     string targetFilename,     string contentID, string contentType, HeaderCollection customHeaders, NewAttachmentOptions options, MailTransferEncoding mailEnc) method
)

Regards,
Alex
Back to Top View Alex's Profile Search for other posts by Alex
 
Deantwo
Newbie
Newbie
Avatar

Joined: 10 January 2018
Location: Denmark
Online Status: Offline
Posts: 5
Posted: 10 January 2018 at 4:02am | IP Logged Quote Deantwo

Alex wrote:
So you basically need to extract base64 blocks from your HTML and convert them into separate attachments?

No, there is no built-in method for this. However, it shouldn't be difficult to write this code directly in your app as it's just string processing:
- find base64-encoded image sequence
- replace it with a cid
- decode its base64 block (Convert.FromBase64String)
- add attachment using msg.Attachments.Add(byte[] data,     string targetFilename,     string contentID, string contentType, HeaderCollection customHeaders, NewAttachmentOptions options, MailTransferEncoding mailEnc) method
)

Yeah, that is what I was afraid of...
Guess I better just get to work then.
Back to Top View Deantwo's Profile Search for other posts by Deantwo
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump

Powered by Web Wiz Forums version 7.9
Copyright ©2001-2004 Web Wiz Guide