<html> <head><script type=""text/javascript""></script></head><body background= ""cid:BgImg"")><table style=""width:100%;""height:100%><thead></thead><tbody>
<tr>
<td><img src= ""cid:myImageID"" style=""width:200px;height:200px""></td>
<td style="";text-align:right;margin:0;""><font face=""Trattatello, fantasy"" size=""6"" color=""#0A6481""><span style=""font-size:24pt;""><b>Dear";
body = body + name;
body=body+",</br><b>Greetings. </b></span></font></td></tr> </tbody> </table> </body></html>
这是我的邮件正文代码......
以下是我为MailService试过的代码..
mail.To.Add("");
mail.Subject = "Alert";
mail.IsBodyHtml = true;
string path = "";\\myImageID path
string BgImgpath="";\\BgImgpath path
AlternateView htmlView = AlternateView.CreateAlternateViewFromString(mail.Body, null, "text/html");
LinkedResource theEmailImage = new LinkedResource(path);
theEmailImage.ContentId = "myImageID";
htmlView.LinkedResources.Add(theEmailImage);
LinkedResource theBackgroundImage = new LinkedResource(BgImgpath, MediaTypeNames.Image.Jpeg);
theBackgroundImage.ContentId = "BgImg";
theBackgroundImage.TransferEncoding = TransferEncoding.Base64;
htmlView.LinkedResources.Add(theBackgroundImage);
mail.AlternateViews.Add(htmlView);
Mail已成功但未提供背景图片(背景图片以xyz.bin附件形式发送)