1

我必须在提交表格后发送注册电子邮件。我在谷歌文档上冲浪,但我不明白是否有办法使用谷歌服务器发送。如果可能的话,请帮助我提供代码。谢谢。

4

1 回答 1

1

参考

protected void btnSubmit_Click(object sender, EventArgs e)
{
try
{
MailMessage Msg = new MailMessage();
// Sender e-mail address.
Msg.From = txtFrom.Text;
// Recipient e-mail address.
Msg.To = txtTo.Text;
Msg.Subject = txtSubject.Text;
Msg.Body = txtBody.Text;
// your remote SMTP server IP.
SmtpMail.SmtpServer = "10.20.72.1";
SmtpMail.Send(Msg);
Msg = null;
Page.RegisterStartupScript("UserMsg", "<script>alert('Mail sent thank you...');if(alert){ window.location='SendMail.aspx';}</script>");
}
catch (Exception ex)
{
Console.WriteLine("{0} Exception caught.", ex);
}
}
于 2013-10-22T07:02:04.467 回答