asp.net| Send mail
These two days because you want to do a Web page that collects user submissions and then sends messages to a specific mailbox. To send a message inside asp.net 2.0, you can use the System.Net.Mail class below. Http://www.systemnetmail.com/faq/2.1.aspx This address is written by a System.Net.Mail author as if it were an MSDN-like FAQ, which you can refer to when looking at the code. Do not say anything, the following post code it, after all, the code is the most important:
1protected void Btnsend_click (object sender, EventArgs e)
2 {
3 MailMessage mailmessage = new MailMessage ();
4 string strbody;
5
6 mailmessage.from = new MailAddress ("365rss@gmail.com");
7 MailMessage.To.Add ("prlibertine@gmail.com");
8 Mailmessage.subject = "365rss.cn";
9
Ten strbody = "One strbody + + "Strbody + + + Tbadv.text;
13
SendMail (MailMessage);
15}
16
//sendmail
private void SendMail (MailMessage mail)
19 {
SmtpClient smtpclient = new SmtpClient ();
Smtpclient.enablessl = true;
Smtpclient.host = "smtp.gmail.com";
Smtpclient.port = 465;
Smtpclient.credentials = new NetworkCredential ("365rss@gmail.com", "pwd");
Try
26 {
Smtpclient.send (mail);
Label1.Text = "OK";
29}
Catch
31 {
Label1.Text = "false";
33}
34}
35