谁能告诉我在C#中自动发送电子邮件的代码 [英] can any body tell me the code for sending the emails automatically in C#

查看:84
本文介绍了谁能告诉我在C#中自动发送电子邮件的代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我有一张桌子,其中有完整的员工详细信息,包括电子邮件地址....我想要那个.........

该代码必须从表中提取电子邮件"字段,并在我单击提交"按钮时自动将邮件发送给该员工..


谢谢



i have a table in which i have complete employee details includeing the Email address.... wthat i want that ......

the code must fetch the "Email" field from the table and send the mail to that employee automatically as i click on the SUBMIT button..


Thanks

推荐答案

亲爱的朋友,

从表中获取电子邮件ID的代码将类似于:-

Dear Friend,

The code for fetching the email id from the table will be like :-

select Email from [TableName]



单击提交"按钮时,此代码将自动发送电子邮件.



This code on the click of submit button will send email automatically.

System.Net.Mail.MailMessage message = new System.Net.Mail.MailMessage();
message.To.Add("luckyperson@online.microsoft.com");
message.Subject = "This is the Subject line";
message.From = new System.Net.Mail.MailAddress("From@online.microsoft.com");
message.Body = "This is the message body";
System.Net.Mail.SmtpClient smtp = new System.Net.Mail.SmtpClient("yoursmtphost");
smtp.Send(message);



有关更多详细信息,请参阅此链接:- http://social .msdn.microsoft.com/Forums/zh-CN/netfxnetcom/thread/a75533eb-131b-4ff3-a3b2-b6df87c25cc8 [



For more details please refer this link:- http://social.msdn.microsoft.com/Forums/en/netfxnetcom/thread/a75533eb-131b-4ff3-a3b2-b6df87c25cc8[^]

I hope this will help you out.

Thanks


这篇关于谁能告诉我在C#中自动发送电子邮件的代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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