我正在使用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);
}
电子邮件已发送,但它是纯文本格式。我做错了什么?
答案 0 :(得分:0)