无法在手机

时间:2015-07-01 14:07:32

标签: c# html email

下面的代码我用来发送和发送电子邮件,其中嵌入了html和imaged,这在我的网络浏览器中查看电子邮件时有效。我的问题是当我试图在手机上查看电子邮件时。这个功能将用于营销,我需要这个工作,我需要启用任何其他设置才能在手机上工作吗?

    string htmlBody = "<html><body><h1>Picture</h1><br><img src=\"cid:Pic1\"><img src=\"cid:Pic2\"></body></html>";

    AlternateView avHtml = AlternateView.CreateAlternateViewFromString
                (htmlBody, null, MediaTypeNames.Text.Html);
            string attachmentPath2 = "C:\\Users\\Sheena\\documents\\visual studio 2013\\Projects\\WebApplication1\\WebApplication1\\butterfly.jpeg";
            string attachmentPath3 = "C:\\Users\\Sheena\\documents\\visual studio 2013\\Projects\\WebApplication1\\WebApplication1\\Picture123.jpeg";
            // Create a LinkedResource object for each embedded image
            LinkedResource pic1 = new LinkedResource(attachmentPath2, MediaTypeNames.Image.Jpeg);
            LinkedResource pic2 = new LinkedResource(attachmentPath3, MediaTypeNames.Image.Jpeg);
            pic1.ContentId = "Pic1";
            pic2.ContentId = "Pic2";
            avHtml.LinkedResources.Add(pic1);
            avHtml.LinkedResources.Add(pic2);`


            // Add the alternate views instead of using MailMessage.Body
            MailMessage m = new MailMessage();
            //message.AlternateViews.Add(Mail_Body());
            m.AlternateViews.Add(avHtml);` 

0 个答案:

没有答案