|
<%@ Import Namespace="System.Web.Mail" %> <script runat="server"> MailMessage mail=new MailMessage(); mail.From="service@brookes.com"; mail.To="brookes@brookes.com"; mail.BodyFormat=MailFormat.Text; mail.Body="a test smtp mail."; mail.Subject="r u ok?"; mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1"); //basic authentication mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", "brookes"); //set your username here mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "walkor"); //set your password here SmtpMail.SmtpServer="lsg.moon.net"; SmtpMail.Send(mail); </script>
有了这种方法,终于可以不必再借助于Jmail、EasyMail等第三方组件,而只简单使用SmtpMai就可以l完成邮件的发送了!
上一页 [1] [2]
|