Outlook 上的电子邮件看起来不同,图像尺寸不同
我创建了一个 razor 页面,该页面向一组用户发送电子邮件确认已发出请求。当我在网络或 Windows 电子邮件应用程序上查看收件箱时,邮件看起来正是我想要的方式。但用户使用 Outlook 客户端查看电子邮件,邮件看起来差别太大,徽标占据了整个表格单元格,其余部分看起来很小。我使用替代视图来嵌入图像,但我不知道图像是否导致问题或其他问题。这是我的代码:
string contentID = Guid.NewGuid().ToString().Replace("-", "");
tab = tab.Replace("/img/logo500.png", "cid:" + contentID);
// tab = tab.Replace("<div id=\"divLinkAprob\"></div>", "<a href=http://localhost:999/SolicitudAdicionalesMP?op=" + op + "&lote=1121035&producto=" + producto.Replace(" ", "%20") + "&itemcode=" + itemCode + "&itemname=" + itemName.Replace(" ", "%20") + "&cantenvasada=" + cantEnvasada + "&cantasignada=" + cantAsignada + "&adicional=" + adicional + "&poradicional=" + porAdicional + "&motivo=" + motivo.Replace(" ", "%20") + "&tab=" + tab.Replace(" ", "%20") + ">APROBAR</a>");
tab = tab.Replace("<div id=\"enviadoPor\"></div>", "Aprobado por: " + usuario);
tab += "Aprobado por: " + usuario;
AlternateView htmlView = AlternateView.CreateAlternateViewFromString(tab, null, "text/html");
//path of image or stream
LinkedResource imagelink = new LinkedResource("wwwroot/img/logo500.png", "image/png");
imagelink.ContentId = contentID;
imagelink.TransferEncoding = System.Net.Mime.TransferEncoding.Base64;
htmlView.LinkedResources.Add(imagelink);
mail.AlternateViews.Add(htmlView);
I created a razor page that sends and email confirming to a group of users that a request has been made. When I look my inbox on the web or the windows email app, the mail looks jsut the way I want it. But the users use the outlook client to check on their emails and the mail looks way too different with the logo taking a whole table cell and the rest looks tiny. I use an alternate view to embbed the image but I don't know if the image is causin the problem or something else. Here's my code:
string contentID = Guid.NewGuid().ToString().Replace("-", "");
tab = tab.Replace("/img/logo500.png", "cid:" + contentID);
// tab = tab.Replace("<div id=\"divLinkAprob\"></div>", "<a href=http://localhost:999/SolicitudAdicionalesMP?op=" + op + "&lote=1121035&producto=" + producto.Replace(" ", "%20") + "&itemcode=" + itemCode + "&itemname=" + itemName.Replace(" ", "%20") + "&cantenvasada=" + cantEnvasada + "&cantasignada=" + cantAsignada + "&adicional=" + adicional + "&poradicional=" + porAdicional + "&motivo=" + motivo.Replace(" ", "%20") + "&tab=" + tab.Replace(" ", "%20") + ">APROBAR</a>");
tab = tab.Replace("<div id=\"enviadoPor\"></div>", "Aprobado por: " + usuario);
tab += "Aprobado por: " + usuario;
AlternateView htmlView = AlternateView.CreateAlternateViewFromString(tab, null, "text/html");
//path of image or stream
LinkedResource imagelink = new LinkedResource("wwwroot/img/logo500.png", "image/png");
imagelink.ContentId = contentID;
imagelink.TransferEncoding = System.Net.Mime.TransferEncoding.Base64;
htmlView.LinkedResources.Add(imagelink);
mail.AlternateViews.Add(htmlView);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论