NET简单发送电子邮件
using System.Net.Mail;
string txtTitle = this.txtTitle.Text;
string txtName = this.txtName.Text;
string txtEmail = this.txtEmail.Text;
string txtTel = this.txtTel.Text;
string txtAddress = this.txtAddress.Text;
string txtContent = this.txtContent.Text;
string body = "";
body = body + "留言标题:" + txtTitle + "<br>";
body = body + "您的姓名:" + txtName + "<br>";
body = body + "您的邮件:" + txtEmail + "<br>";
body = body + "联系电话:" + txtTel + "<br>";
body = body + "联系地址:" + txtAddress + "<br>";
body = body + "留言内容:" + txtContent + "<br>";
SmtpClient client = new SmtpClient();
MailAddress from = new MailAddress(txtEmail);
MailAddress to = new MailAddress("dbjbpmph@163.com");
MailMessage message = new MailMessage(from, to);
message.Body = body;
message.Subject = "盗版举报";
message.IsBodyHtml = true;
client.DeliveryMethod = SmtpDeliveryMethod.PickupDirectoryFromIis;
client.Send(message);
Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "success", "alert('提交成功!');", true);
message.Dispose();