Hi.
I have a problem when trying to embed pictures to an email. It works fine on windows server and the email is shown correct but when I try to put it in production which runs on Linux (mono 2.4) it sends the pictures as attachments (and deletes the first one of them.). I have tried alot and have searched everywhere but with no luck.
The code below works fine in windows but attach the embedded pictures in mono. Any surgestions what I can try, I'm running out of idears.
mail.BodyEncoding = System.Text.Encoding.UTF8;
//AddSignature(ref pBodyPlain);
string mBodyHtmlBn = "";
mBodyHtmlBn += "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">";
mBodyHtmlBn += "<HTML><HEAD><META http-equiv=Content-Type content=\"text/html; \"> </HEAD> ";
mBodyHtmlBn += "<body bgcolor=\"#EEEEEE\">";
mBodyHtmlBn += "<table bgcolor=\"#FFFFFF\" border=\"1\" cellpadding=\"8\" bordercolor=\"#CCCCCC\" width=\"500\">";
mBodyHtmlBn += "<tr><td bgcolor=\"B2C6D9\"><img src='cid:header_left' align=\"left\"> <img src='cid:header_right' align=\"right\"></td></tr>";
mBodyHtmlBn += "<tr><td>";
mBodyHtmlBn += "<font face=\"verdana, arial\" size=\"2\">";
mBodyHtmlBn += pBodyHtml;
mBodyHtmlBn += "</font>";
mBodyHtmlBn += "<img src='cid:logo_bottom' align=\"right\">";
mBodyHtmlBn += "<br><br>";
mBodyHtmlBn += "</td></tr></table>";
mBodyHtmlBn += "</body></HTML>";
// PLAIN / HTML
//System.Net.Mail.AlternateView plainView = System.Net.Mail.AlternateView.CreateAlternateViewFromString(pBodyPlain, null, "text/plain");
System.Net.Mail.AlternateView htmlView = System.Net.Mail.AlternateView.CreateAlternateViewFromString(mBodyHtmlBn, new System.Net.Mime.ContentType("text/html")); //multipart/mixed")); //, null, "text/html");
System.Net.Mail.LinkedResource logo = new System.Net.Mail.LinkedResource(System.AppDomain.CurrentDomain.BaseDirectory + "/images/mailheader_newsletter.gif"); // + sHeaderImg);
logo.ContentId = "header_left";
//add the LinkedResource to the appropriate view
htmlView.LinkedResources.Add(logo);
System.Net.Mail.LinkedResource logo2 = new System.Net.Mail.LinkedResource(System.AppDomain.CurrentDomain.BaseDirectory + "/images/mail_logo.gif", "image/gif");
logo2.ContentId = "header_right";
//add the LinkedResource to the appropriate view
htmlView.LinkedResources.Add(logo2);
System.Net.Mail.LinkedResource logo3 = new System.Net.Mail.LinkedResource(System.AppDomain.CurrentDomain.BaseDirectory + "/images/mail_logo_bottom.gif", "image/gif");
logo3.ContentId = "logo_bottom";
//add the LinkedResource to the appropriate view
htmlView.LinkedResources.Add(logo3);
mail.AlternateViews.Add(htmlView);
mail.Body = mBodyHtmlBn;
System.Net.Mail.SmtpClient mSmtpClient = new System.Net.Mail.SmtpClient(Config.GetString("SMTP"));
//mail.IsBodyHtml = true;
mSmtpClient.Send(mail);