通过 SMTPClient 发送电子邮件时需要更改 FromEmail 字符串

发布于 2024-08-04 16:23:34 字数 959 浏览 3 评论 0原文

我的电子邮件发送代码

 MailMessage msg = new MailMessage("[email protected]", "[email protected]", "testing email", "to check from email label text");
    SmtpClient smpt = new SmtpClient();
    smpt.Send(msg);

[email protected] 用户打开电子邮件时,在从电子邮件中,提到了[email protected],我需要在其中显示类似Abc Corporation [[电子邮件受保护]]

如何我可以更改电子邮件地址标签吗

谢谢

My Email Sending Code

 MailMessage msg = new MailMessage("[email protected]", "[email protected]", "testing email", "to check from email label text");
    SmtpClient smpt = new SmtpClient();
    smpt.Send(msg);

When email open by [email protected] user, In the from email, its mentioned [email protected] where as I need to show like Abc Corporation [[email protected]]

How can I change from Email address label

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

岁月打碎记忆 2024-08-11 16:23:34

使用真实姓名和电子邮件地址创建 MailAddress,然后将其提供给 MailMessage。

来自 MSDN(来自属性邮件留言)。

  MailAddress from = new MailAddress("[email protected]", "Ben Miller");
  MailAddress to = new MailAddress("[email protected]", "Jane Clayton");
  MailMessage message = new MailMessage(from, to);

Create a MailAddress with the real name and email address, then supply that to the MailMessage.

From MSDN (From property for MailMessage).

  MailAddress from = new MailAddress("[email protected]", "Ben Miller");
  MailAddress to = new MailAddress("[email protected]", "Jane Clayton");
  MailMessage message = new MailMessage(from, to);
寒尘 2024-08-11 16:23:34

使用显示名称

MailMessage m = new MailMessage();
m.From = new MailAddress("[email protected]", "My Mail");

Use the DisplayName

MailMessage m = new MailMessage();
m.From = new MailAddress("[email protected]", "My Mail");
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文