using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Net.Mail;//需要引用此命名空间
using System.Net;
public partial class Default4 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
//邮件发送
protected void Button1_Click(object sender, EventArgs e)
{
//可以通过循环发送100次,一万次。。
// for (int i = 0; i < 99; i++)
// {
//发送电子邮件的类
MailMessage message = new MailMessage();
//发件人地址
message.From = new MailAddress("hua_zhizun@126.com", "至尊花");
//收件人地址
message.To.Add(new MailAddress(" 403444638@qq.com", "楠弟"));
//邮件的主题
message.Subject = "楠弟,,这要算最好的教程。";//+i;
//邮件的内容
message.Body = "待会截个图,,算图文教程。。哈哈。。";//+i;
//邮件传输协议
SmtpClient client = new SmtpClient("smtp.126.com");
//发件人的身份登陆验证
//哎,,又出卖了我的邮箱与密码。。编程交流可与发送此邮箱
client.Credentials = new NetworkCredential("hua_zhizun@126.com", "wanglonghua80325");
//发送邮件
client.Send(message);
}
}
|