【问题标题】:send auto generated email using asp.net [closed]使用asp.net发送自动生成的电子邮件[关闭]
【发布时间】:2012-09-15 17:28:35
【问题描述】:

当用户在文本框中输入电子邮件地址后点击发送按钮时如何发送电子邮件(自动生成)?有什么网站可以参考吗?非常感谢

【问题讨论】:

  • 你应该做更多的谷歌。有很多例子。
  • 我只需要这里任何人的建议。就是这样:)

标签: c# asp.net email


【解决方案1】:

您确实应该做更多的研究,因为您正在寻找的答案很容易找到。但是,这将为您指明正确的方向。

using System.Net.Mail;  
    MailMessage mm = new MailMessage("from@here.com", "to@there.com");
    mm.Subject = "some subject";
    mm.IsBodyHtml = true;
    mm.Body = "<span>your html goes here -- for plain text see IsBodyHtml property</span>";         
    SmtpClient client = new SmtpClient();
    client.Send(mm);

【讨论】:

  • 你为什么要设置IsBodyHtml = true,然后将Body设置为一些纯文本? ;-)
  • IsBodyHtml 如果消息正文是 Html 则设置为 true;否则为假。默认为假。
  • @Pushpendra 我完全了解该属性的用途 - 我只是想您可能想让 OP 更清楚为什么当 OP 可能不需要 html 时将其设置为 true身体!
  • 是的,设置 IsBodyHtml = true 以便您现在发送的任何内容都不需要更改我们的需求。
猜你喜欢
  • 2013-10-30
  • 1970-01-01
  • 2021-08-31
  • 1970-01-01
  • 2011-09-22
  • 2012-05-23
  • 2022-10-24
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多