Send mail with attachment in asp.net

//send mail
   MailMessage message = new MailMessage();
   message.To = this.txtEmail.Text.Trim();
   message.From = this.txtMyemail.Text.Trim();
   message.Body = this.txtBody.Text.Trim();
   message.Subject = this.txtTitle.Text.Trim();
   string wsFile = Server.MapPath(Request.ApplicationPath) + "\\Script\\" + site + "_" + strMM + "_WS.txt";
   MailAttachment wsAt = new MailAttachment(wsFile);
   message.Attachments.Add(wsAt);
   string strMailServer = "mail.intel.com";
   SmtpMail.SmtpServer = strMailServer;
   SmtpMail.Send(message);
   Response.Write ("<script language=javascript>alert('Your email was send out successfully.')</script>");

posted on 2008-01-04 21:32  飞天舞者  阅读(232)  评论(0编辑  收藏  举报

导航

For more information about me, feel free email to me winston.he@hotmail.com