簡體   English   中英

如何使用發送網格以特定格式發送郵件

[英]how to send a mail in a particular format by using send grid

我可以使用發送網格 API 發送郵件 如何使用發送網格發送特定格式的郵件

郵件格式

請找到郵件格式的圖像

將正文作為 HTML 傳遞並設置 IsBodyHtml = true。 我使用 SendGrid 執行此操作。

public Task SendEmailAsync(string email, string subject, string htmlMessage)
{


    var client = new SmtpClient(host, port)
    {
        Credentials = new NetworkCredential(userName, password),
        EnableSsl = false
    };
    return client.SendMailAsync(
        new MailMessage(from, email, subject, htmlMessage) { IsBodyHtml = true }
    );
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM