We don’t allow questions seeking recommendations for software libraries, tutorials, tools, books, or other off-site resources. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(3)
System.Web.UI.WebControls.MailDefinition
不支持数据绑定,仅支持文本替换。
System.Web.UI.WebControls.MailDefinition
Doesn't support databinding, just text replacement.
System.Net.Mail
命名空间确实拥有您所需的一切。查看系统上的 MSDN 文档.Net.Mail,并查看此站点专用该命名空间。
您可以获得诸如
MailMessage
、MailAddress
、SmtpClient
等类 - 真正满足您的需要 - 无需其他第三方库,真的。如何创建消息正文(无论您想使用什么模板来创建消息正文)完全取决于您。这不应该是邮件发送工具的一部分 - 它只是发送邮件(这是它的单一职责)。如何创建邮件正文是一个不同的责任,由其他一些类处理 - 您完全可以自由地在那里使用什么。
The
System.Net.Mail
namespace has all you need, really.Check out the MSDN docs on System.Net.Mail, and check out this site dedicated to that namespace.
You get classes like
MailMessage
,MailAddress
,SmtpClient
and a lot more - really all you need - no need for other, third-party libraries, really.How you create the message body - whatever templating you want to use to do so - is totally up to you. This shouldn't be part of the mail-sending facility - it just sends mails (that's its single responsibility). How to create the mail body is a different responsibility, handled by some other classes - you're totally free what to use there.
请注意,.NET Framework 不附带 SMTP 服务器,因此您需要访问 SMTP 服务器才能发送您使用库或模板系统构建的任何电子邮件。如果您将其作为公司项目的一部分来执行,这可能不是问题,因为您的企业无疑拥有这种能力。作为家庭项目,您需要使用 ISP 提供的详细信息,以便发送电子邮件。
Note that the .NET Framework does not come with an SMTP server and so you will need to have access to an SMTP server in order to send any email that you construct using a library or template system. This might not be an issue if you are doing this as part of a company project as your business will not doubt have that ability. As a home project you would need to use the details provided by your ISP so you can send an email.