在.net应用程序中发送电子邮件 [英] sending email in .net application

查看:82
本文介绍了在.net应用程序中发送电子邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我想在我的应用程序中发送邮件,在asp.net,c#和sql server中。

I want to send in mail in my application, which in asp.net,c# and sql server.

所以,最好使用sql server或使用webservice发送电子邮件?

提前感谢,

Addon。

推荐答案

您好,

您可以使用C#或SQL Server发送电子邮件。您应该研究您的架构并找到最适合您的方法。我将解释两者的一些功能。

You can send email using C# or SQL Server. You should study your architecture and find the best suitable method for you. I will explain some features about both.

通过C#发送电子邮件

Email Through C#

你必须使用
SmtpClient <强> 类&NBSP;在System.Net.Mail命名空间中。您还需要使用MailMessage类来编写电子邮件。您必须使用SMTP凭据进行配置。如果您只想发送1或2封电子邮件,并且不需要经常从数据库中提取电子邮件
内容,这是最佳选择。

You have to use SmtpClient class  in System.Net.Mail namespace. You will also need to use MailMessage class to compose the email. You have to configure it with SMTP credentials.If you just want to send 1 or 2 emails and the email content need not to be fetched from DB frequently this is the best option.

通过SQL Server中的DBMail发送电子邮件

Email Through DBMail in SQL Server

这是SQL Server中用于在任何存储过程中发送电子邮件的一项了不起的功能。如果电子邮件内容需要大量数据库内容,这是一个可行的选择。如果您想发送许多电子邮件,这也是一个不错的选择。关于此方法的详细步骤
可以在以下链接找到:

This is an amazing feature in SQL Server to send emails inside any Stored Procedure. If the email content needs a lot of Database Content this is a viable option. It is also a good option if you want to send many emails. Detailed procedure about this method can be found at this link:

http://blog.sqlauthority.com/2008/08/23/sql-server-2008-configure -database-mail-send-email-from-sql-database /

http://blog.sqlauthority.com/2008/08/23/sql-server-2008-configure-database-mail-send-email-from-sql-database/


这篇关于在.net应用程序中发送电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆