0

I have an html template, and I have used the below image & source, but the template is displaying properly, but the image is not displayed in others system but visible in my local system, Where I did go wrong? And I have tried with base64 format but outlook is not supporting the base64 format. So is there any other option to solve this problm ?

My same Html img src,

<img src="localhost:65432\appcore\content\images\logo.png />

And my server side code to send mail,

... 
using (var client = new WebClient())
                    {
                        string reader = client.DownloadString(templatePath);
                        StringBuilder sb = new StringBuilder();
                        sb.Append(reader);
                        sb.Replace("&lt;MessageBody&gt;", email.Body);

                        Messagebody = sb.ToString();
                    }

  message = new MailMessage(
                    "InEight.Mail@ineight.com", // not implemented/supported 
  by SMTP server: email.From, 
                    (email.To ?? "").Replace(";", ","), email.Subject, 
  ((email.IsBodyHtml == true) ? 
  HttpUtility.HtmlDecode(Messagebody.Replace(@"\r\n", Environment.NewLine)) 
  : Messagebody))
                {
                    IsBodyHtml = email.IsBodyHtml
                };

  var mailer = new SmtpClient
                {
                    Host = RuntimeConfig.SMTP.Host,
                    Credentials = new 
  System.Net.NetworkCredential(RuntimeConfig.SMTP.Username, 
  RuntimeConfig.SMTP.Password),
                    Port = RuntimeConfig.SMTP.Port,
                    EnableSsl = RuntimeConfig.SMTP.EnableSsl,
                    Timeout = PlatformServiceConstants.SMTPTimeOut

                };


                mailer.Send(message);
                email.IsSent = true;
                email.SentOn = DateTime.UtcNow;
    ...
Md Aslam
  • 1,228
  • 8
  • 27
  • 61
  • Possible duplicate of [Send a base64 image in HTML email](https://stackoverflow.com/questions/16242489/send-a-base64-image-in-html-email) – Tuan Zaidi Dec 14 '18 at 09:40
  • So Base64 is blocked in outlook2010+ ? – Md Aslam Dec 14 '18 at 09:59
  • 2
    Base64 is not supported nearly everywhere. In addition to the link above, [this is also a good (and more recent) answer](https://stackoverflow.com/questions/46783599/base64-encoded-image-is-not-showing-in-gmail/46789485#46789485). – Ted Goas Dec 14 '18 at 16:33
  • Yeah thank you for your response but is there any solution to fix the Problem, I mean need to send a autogenerated mail with images. Note: if I use the server path to fetch the image then it's not showing in client's system due to the image not downloaded or not available in the client's system . So how to handle this situation ? – Md Aslam Dec 16 '18 at 13:36
  • Outlook be default disables images with a security notice. The image download is at the users end and we cant do anything about it i am afraid. If you using a web server to serve the images, make sure the full path is in the email source. – Syfer Dec 16 '18 at 22:35

0 Answers0