我想为单击电子邮件表单提交按钮时要发送/转发的消息添加一个额外的电子邮件地址,最简单的方法是什么?
public partial class Contact : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
string name = txtName.Text;
string emailaddress = txtEmail.Text;
string body = txtComment.Text;
MailAddress From = new MailAddress(emailaddress);
MailAddress To = new MailAddress("111@1111.com");
MailMessage email = new MailMessage(From, To);
email.Subject = "Comment from Website from " + name;
email.Body = body;
SmtpClient smtp = new SmtpClient("smtp.1111.com");
smtp.Credentials = new System.Net.NetworkCredential("111@1111.com", "1111111111");
smtp.Send(email);
email.Dispose();
ClientScript.RegisterClientScriptBlock(this.GetType(), "Email Confirm", "alert('Email Sent!');", true);
txtComment.Text = "";
txtEmail.Text = "";
txtName.Text = "";
}
protected void txtEmail_TextChanged(object sender, EventArgs e)
{
}
}
我们会说我的额外电子邮件地址是 smtp.2222.com 222@2222.com,身份验证为 22222。感谢大家的关注。