邮件中未显示图片

时间:2018-06-14 11:01:39

标签: asp.net-mvc-4 smtp

我有一个我需要在邮件中显示的徽标。在我的本地计算机上显示徽标,但在实时环境所在的服务器上,徽标未显示。

首先,我尝试使用这样的路径:

imagePath = "~/Images/email-logo2.png";

email-logo2.png也存在于本地计算机和服务器上的同一文件夹中。

enter image description here

图片已添加到电子邮件中,如下所示:

HTML:

<img class="auto-style4" src="{PictureSrc}" /><br />

C#代码:

switch (property)
{
    case "PictureSrc":
        string imagePath = "";
        imagePath = "~/Images/email-logo.png";

        content = content.Replace("{" + property + "}", HttpContext.Server.MapPath(imagePath));

我尝试使用图片的网址

   string url = "http://xxx/images/email-logo2.png";
   content = content.Replace("{" + property + "}", url);

如果我将此http://xxx/images/email-logo2.png粘贴到浏览器,则会显示图像。但它不起作用,图像没有显示在邮件中。有什么想法吗?

0 个答案:

没有答案