0

我正在使用 asw sdk 发送电子邮件。我在呈现电子邮件时遇到问题。电子邮件发送正常,但在电子邮件网络客户端(例如 Gmail)中,电子邮件是纯文本的。下面是我的代码:

string fileInfo = HttpContext.Current.Server.MapPath("~/Content/template.html");
string html = File.ReadAllText(fileInfo);

MailService.SendEmail(from, html, "Password reset", emails);

template.html 文件是经过验证的严格 html 文件。

发送电子邮件方法:

public static void SendEmail(string emailFrom, string emailBody, string emailSubject, List<string> toAddresses)
    {
        AmazonSimpleEmailServiceConfig amazonConfiguration = new AmazonSimpleEmailServiceConfig();
        AmazonSimpleEmailServiceClient client = new AmazonSimpleEmailServiceClient("keyId","secretKey",amazonConfiguration);                 

        Destination destination = new Destination();
        destination.ToAddresses = toAddresses;
        Body body = new Body() { Html = new Content(emailBody) };

        Content subject = new Content(emailSubject);
        Message message = new Message(subject, body);

        SendEmailRequest sendEmailRequest = new SendEmailRequest(emailFrom, destination, message);

        client.SendEmail(sendEmailRequest);
    }

电子邮件已送达,但它是纯文本格式的。我究竟做错了什么?

4

1 回答 1

0

我弄清楚。Gmail 只是不支持样式标签。你必须把你的样式内联,所以直接放在 div 或 table 标记中。

于 2013-03-25T06:53:18.540 回答