关于提交发邮件的问题
我做了两个textbox 还有一个 button 请问如何点击button 将textbox的内容提交到我的email当中 --------------------编程问答-------------------- 有知道的大虾给个代码啊 --------------------编程问答-------------------- textbox.text=... --------------------编程问答-------------------- MailMessage mm = new MailMessage();mm.From = myReader["FromEmail"].ToString();
mm.To = myReader["ToEmail"].ToString();
mm.Subject = myReader["Subject"].ToString(); ;
mm.Body = strBody;
mm.BodyFormat = MailFormat.Html;
mm.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1"); //basic authentication
mm.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", myReader["UserName"].ToString()); //set your username here
mm.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", myReader["UserPassword"].ToString()); //set your password here
SmtpMail.SmtpServer = myReader["Smtp"].ToString();
SmtpMail.Send(mm);
--------------------编程问答-------------------- 要导入 using System.Net.Mail;
看看我最近写的!不是很好,不过也许有帮助!
--------------------编程问答-------------------- 能不能不验证username password啊,毕竟人家要是点button 最多只会给你用户名,密码不会给啊 --------------------编程问答-------------------- LS
public void SentMial()
{
string toaddress = txtto.Text.ToString().Trim();
string subject = txtsubject.Text.ToString();
string body = Editor1.Text.ToString();
MailAddress from = new MailAddress("wf86157223@163.com");
MailAddress to = new MailAddress(toaddress);
MailMessage message = new MailMessage(from, to);
message.Subject = subject;
message.Body = body;
message.IsBodyHtml = true;
message.SubjectEncoding = System.Text.Encoding.Default;
message.BodyEncoding = System.Text.Encoding.Default;
SmtpClient client = new SmtpClient("smtp.163.com");
NetworkCredential smtpuserinfo = new NetworkCredential();
smtpuserinfo.UserName = "123123123";
smtpuserinfo.Password = "123123123";
client.Credentials = smtpuserinfo;
client.Send(message);
}
4楼的用户名和密码是指163.com注册的用户名和密码吧 --------------------编程问答-------------------- <a href="mailto:?subject=<%#txtSub.Text%>&body=<%#TextBox1.Text%>><font style="FONT-WEIGHT: bold" id="FONT1">转发邮件</font></a> --------------------编程问答--------------------
必须的
补充:.NET技术 , ASP.NET