代码之家  ›  专栏  ›  技术社区  ›  Arun Kumar A.J

向中SendGrid的“发件人”字段添加名称ASP.NET[副本]

  •  -1
  • Arun Kumar A.J  · 技术社区  · 6 年前

    当收到邮件时,在“发件人”中,我需要显示邮件发送人的姓名。我想我需要的是 this

    提前谢谢

    1 回复  |  直到 6 年前
        1
  •  2
  •   mnieto    6 年前

    试着看一下 MailMessage 班级。你在那页上有个例子。

    MailAddress from = new MailAddress("ben@contoso.com", "Ben Miller");
    MailAddress to = new MailAddress("jane@contoso.com", "Jane Clayton");
    MailMessage message = new MailMessage(from, to);
    
    message.Subject = "Using the SmtpClient class.";
    message.Body = @"Using this feature, you can send an e-mail message from an application very easily.";
    SmtpClient client = new SmtpClient();
    client.Send(message);
    

    请注意,没有参数的SmtpClient从应用程序配置/ web.config文件. 你可以看到 mailSettings section