Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Jin Botol 134 posts 287 karma points
    Mar 20, 2018 @ 08:45
    Jin Botol
    0

    Image not displayed in Outlook

    Hi all, Good day!

    After sending an email the logo is not displayed in Outlook but it works in Gmail.

    I found that in the inspect element that the image src is changed into blockedimagesrc

    In my Controller :

    var NotifyCompany = new NotifyCompany()
    {
       Email = model.regE,
       EmailTo = contact.GetPropertyValue<string>("email"),
       DateRegistered = DateTime.UtcNow
    };
    EmailHelpers.SendEmail(NotifyCompany, "NotifyCompany", "New Client Registered");
    

    Email Helpers :

    public static ActionResponse SendEmail(IEmail model, string emailTemplate, string subject, List<HttpPostedFileBase> files = null)
    {
        try
        {
            var template =
            System.IO.File.ReadAllText(HttpContext.Current.Server.MapPath(string.Format("~/Templates/{0}.cshtml", emailTemplate)));
            var body = Razor.Parse(template, model);
    
            var attachments = new List<Attachment>();
            if (files != null && files.Any())
            {
                foreach (var file in files)
                {
                    var att = new Attachment(file.InputStream, file.FileName);
                    attachments.Add(att);
                }
            }
    
            var email = Email
            .From(ConfigurationManager.AppSettings["Email:From"], "myWebsiteEmail")
            .To(model.EmailTo)
            .Subject(subject)
            .Attach(attachments)
            .Body(body).BodyAsHtml();
    
            email.Send();
            return new ActionResponse()
            {
                Success = true
            };
        }
        catch (Exception ex)
        {
            return new ActionResponse()
            {
                Success = false,
                ErrorMessage = ex.Message
            };
        }
    }
    

    in my Email Template

    <img src="...mywebiste.com/image/logo.png"/>
    

    I badly need help, I'm stock on this. Any help would be appreciated. Thanks

    Regards,

    Jin

  • Barry Fogarty 493 posts 1129 karma points
    Mar 20, 2018 @ 09:25
    Barry Fogarty
    100

    Hi Jin,

    This will not be anything to do with your code, but your email client's content display rules. You should have a message above the email with a link that will allow images from the sender. Or you may be able to add your domain to a whitelist that allows all images from that location.

    Either way, it is not something you can fix in your code, it has to be enabled in the email client itself.

    See https://litmus.com/blog/rendering-css-support-more-in-office-365s-outlook-web-app

  • Jin Botol 134 posts 287 karma points
    Mar 21, 2018 @ 03:31
    Jin Botol
    0

    Hi Barry,

    Follow up question, when client's use a MS Outlook App the styles is not working. (margin, padding, etc..) also the site logo is not displayed but the social icons are displayed.

    Any idea about this??

    Regards,

    Jin

  • Jin Botol 134 posts 287 karma points
    Mar 21, 2018 @ 01:51
    Jin Botol
    0

    Hi Barry,

    Thanks for your reply. And for the good information.

    Regards,

    Jin

  • Barry Fogarty 493 posts 1129 karma points
    Mar 21, 2018 @ 11:07
    Barry Fogarty
    0

    Sounds like the OUtlook app is blocking requests to your domain but allowing them to other, commonly used domains. That would explain why the social icons are displayed (if they are hosted off-site).

  • Jin Botol 134 posts 287 karma points
    Mar 22, 2018 @ 08:54
    Jin Botol
    0

    The social icons are also in my server. I guess the inline css is not working that is why my site logo didn't display, and also my social icons , they have no space (margin-right)

    Regards,

    Jin

  • John Bergman 483 posts 1132 karma points
    Mar 26, 2018 @ 19:48
    John Bergman
    0

    Something else, the email software we use (mailbee.net) has a setting that allows you to turn image embedding on/off, this could be an issue. AND you need to be sure you render any urls with the full domain included.

    I have never been able to get linked CSS to work in any of our email reliably, so I render any CSS directly in the email itself.

  • Jin Botol 134 posts 287 karma points
    Mar 27, 2018 @ 09:38
    Jin Botol
    0

    Hi John,

    It's okay now, some of the css property is not working on the Outlook Desktop App.

    Thanks your help.

    Regards,

    Jin

Please Sign in or register to post replies

Write your reply to:

Draft