using System.Net.Mail; using System.Net;protected void Button1_Click1(object sender, EventArgs e) { MailMessage mailObj = new MailMessage(); mailObj.From = new MailAddress("[email protected]");
MailAttachment m= new MailAttachment(this.TextBox1.Text);//附件 Attachment m = new Attachment(this.TextBox1.Text); mailObj.To.Add("[email protected]"); mailObj.Subject = "asp.net 发送mail测试";
using System.Net.Mail;
using System.Net;protected void Button1_Click1(object sender, EventArgs e)
{
MailMessage mailObj = new MailMessage();
mailObj.From = new MailAddress("[email protected]");
MailAttachment m= new MailAttachment(this.TextBox1.Text);//附件
Attachment m = new Attachment(this.TextBox1.Text); mailObj.To.Add("[email protected]");
mailObj.Subject = "asp.net 发送mail测试";
mailObj.IsBodyHtml = true;//输出html
mailObj.Body = "<a href=http://www.google.com>google.</a>";
mailObj.Attachments.Add(m);//添加附件 SmtpClient smtp = new SmtpClient();
smtp.Host = "smtp.163.com";
smtp.UseDefaultCredentials = true;
smtp.Credentials = new NetworkCredential("[email protected]", "pwd");
smtp.Send(mailObj);
}
这些收发邮件需要 安装或 配置些什么不,IIS?