在Web应用程序中发送邮件

在Web应用程序中发送邮件

问题描述:

这里正在开发一个Web应用程序,其中是将一些数据保存到数据库中.我要保存的数据保存在我的权限下,请给我这个朋友的解决方案.

Hi,here am developing a web application and in that am saving some data into the database. The data what am saving i want mail that to my authority, give me the solutions for this friends.

^ ]可能会有所帮助.
This[^] may help.


尝试这些结果
发送邮件
try these results
Sending mail


C#代码为:

MailMessage ms = new MailMessage("from@xyz.com","to@xyz.com",您的主题",
您的邮件");
SmtpClient sc = new SmtpClient("localhost",25);
sc.Send(ms);


在web.config文件中进行一些修改:

< system.net>
< mailSettings>
< smtp from ="from@xyz.com">
< network host ="localhost" password ="password @ 123"
userName ="from@xyz.com"/>
</smtp>
</mailSettings>
</system.net>

试试这个会起作用的..
C# code will be:

MailMessage ms = new MailMessage("from@xyz.com", "to@xyz.com", "Your subject",
"your mail message");
SmtpClient sc = new SmtpClient("localhost", 25);
sc.Send(ms);


Do some modification in web.config file:

<system.net>
<mailSettings>
<smtp from="from@xyz.com">
<network host="localhost" password="password@123"
userName="from@xyz.com" />
</smtp>
</mailSettings>
</system.net>

Try this it''ll work..