编辑器加载中...
MailMessage message = new MailMessage();
message.To.Add("cuihy@young-sun.com");// 收件人
message.Subject = "主题2";//主题
message.From = new System.Net.Mail.MailAddress("kefu@mail.51zaoxing.com", "cuihy");//发件人邮箱及昵称(这个地方随便写,没事)
message.Body = "内容2";//内容
SmtpClient smtpClient = new SmtpClient();
smtpClient.EnableSsl = false; //是否使用安全套接字层 (SSL) 加密连接
smtpClient.Host = "192.168.0.200";
smtpClient.Port = 25;//端口号
smtpClient.Credentials = new System.Net.NetworkCredential("用户名", "密码");//填写登录邮箱的用户名及密码
try
{
smtpClient.Send(message);
Response.Write("<script language='javascript'>window.alert('成功!');</script>");//此处用“。”代替“.”以免影响此页面浏览
}
catch
{
Response.Write("<script language='javascript'>window.alert('失败!');</script>");//此处用“。”代替“.”以免影响此页面浏览
}