WEB开发网      濠靛倻鏅悵顖涚附閽樺鐎诲ù婊庡亾缁辨帗鎷呴悩鍨暠濞戞挴鍋撳ù鐘烘閸ㄥ孩绂嶉锝喰﹂柟瀛樺灣濠婃垿鎯冮崟顏嗩伇濞寸姾妫勬慨鈺呭礉濞戝磭骞㈤悹鍥у槻閸ㄥ孩绂嶉敓锟� ---闁挎洩鎷�
开发学院WEB开发ASP 使用 System.Web.Mail发送邮件 阅读

使用 System.Web.Mail发送邮件

 2007-12-09 13:39:07 来源:WEB开发网 闁靛棴鎷�闁告垵绻愰惃顒傗偓娑欍仦缂嶏拷濠⒀呭仜閵囧洨鈧稒銇炵紞锟�闁靛棴鎷�  闁稿繗娅曢弫鐐次涘▎鎰泚闁告娲ㄥ▓鎴濐嚗椤旂厧瑙�
核心提示://simple email mail.To = "me@mycompany.com"; mail.From = "you@yourcompany.com"; mail.Subject = "this is a test email."; mail.Body
//simple email
mail.To = "me@mycompany.com";
mail.From = "you@yourcompany.com";
mail.Subject = "this is a test email.";
mail.Body = "this is my test email body";
SmtpMail.SmtpServer = "localhost"; //your real server goes here
SmtpMail.Send( mail );
//simple Html email
mail.To = "me@mycompany.com";
mail.From = "you@yourcompany.com";
mail.Subject = "this is a test email.";
mail.BodyFormat = MailFormat.Html;
mail.Body = "this is my test email body.<br><b>this part is in bold</b>";
SmtpMail.SmtpServer = "localhost"; //your real server goes here
SmtpMail.Send( mail );
//email with attachments
MailMessage mail = new MailMessage();
mail.To = "me@mycompany.com";
mail.From = "you@yourcompany.com";
mail.Subject = "this is a test email.";
mail.Body = "this is my test email body.";
MailAttachment attachment = new MailAttachment( Server.MapPath( "test.txt" ) ); //create the attachment
mail.Attachments.Add( attachment ); //add the attachment
SmtpMail.SmtpServer = "localhost"; //your real server goes here
SmtpMail.Send( mail );
//change the TO address to a friendly name
mail.From = "\"John Smith\" <you@yourcompany.com>";
//multiple recipients
mail.To = "me@mycompany.com;him@hiscompany.com;her@hercompany.com";
http://www.systemwebmail.com/faq/1.aspx

http://www.systemwebmail.com/faq/1.aspx

http://www.systemwebmail.com/faq/1.aspx

http://www.systemwebmail.com/faq/1.aspx

Tags:使用 System Web

编辑录入:coldstar [复制链接] [打 印]
赞助商链接