2

MVC 4, c#.net sending emails using ActionMailer.Net.Mvc.EmailResult using smtp server

using: _email_layout.cshtml

<!DOCTYPE html>
<html>
<head></head>
<body>
    <img alt="header.png" src="cid:header.png" />
    <div id="main">
        @RenderBody()
    </div>
</body>
</html>

in MailController.cs

ActionMailer.Net.Attachments.Inline.Add("header.png",  System.IO.File.ReadAllBytes(System.Web.HttpContext.Current.Server.MapPath("~/Content/Images/pic.png")));

ActionMAiler.Net.Mvc.EmailResult v = Email("myemailview", modelforview);

Sending email with:

myEmail.DeliverAsync();

If sent to our company emails - image is shown in the email as expected.

If sent to gmail.com - inline pic.png is not in email. Instead there is kind-of place holder with "header.png" next to it and garbage text at the end of email.

  1. Is it possible to see how to see html body of resulting email ? Where is it in EmailResult object ?
  2. Any ideas why inline image does not go through to outside emails?

Many thanks

Karen Slon
  • 233
  • 1
  • 4
  • 16
  • You can check the html at mail client like outlook client or gmail (email -> show original). – user1672994 Jun 06 '18 at 17:06
  • Thank you, I compared original-email-with-image-issue with original-old-email-with-good-image and I can see that difference is that in old-email-with-good-image for the image "Content-Type: application/octet-stream" and in the email-with-image-issue "Content-Type: text/plain". But no clue why it's happening. . . – Karen Slon Jun 06 '18 at 18:39

0 Answers0