使用 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
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
[]
- ››使用脚本恢复WinXP系统的用户登录密码
- ››WEBGAME龙虎榜,《传奇国度》成黑马
- ››WebQQ 2.0添加谷歌音乐方法
- ››WebLogic调整Java虚拟机性能优化参数
- ››使用phpMyadmin创建数据库及独立数据库帐号
- ››使用Zend Framework框架中的Zend_Mail模块发送邮件...
- ››使用cout标准输出如何控制小数点后位数
- ››使用nofollow标签做SEO的技巧
- ››webqq2.0协议研究(3)-ClientId生成
- ››Web.config配置文件
- ››WebBrowser组件的execWB方法——Delphi控制浏览器...
- ››Web前端设计模式--制作漂亮的弹出层
赞助商链接