网络编程
位置:首页>> 网络编程>> ASP.NET>> 在ASP.NET2.0通过SMTP的验证发送EMAIL

在ASP.NET2.0通过SMTP的验证发送EMAIL

作者:小春 来源:zc's blogs 发布时间:2007-09-23 12:29:00 

标签:email,asp.net

在ASP.NET2.0通过SMTP的验证发送EMAIL ,代码如下:


’Create a new MailMessage object and specify the"From" and "To" addresses
Dim Email As New System.Net.Mail.MailMessage( _
   "Brad.Kingsley@orcsweb.com", "Brad@KingsleyTeam.com")
Email.Subject = "test subject"
Email.Body = "this is a test"
Dim mailClient As New System.Net.Mail.SmtpClient()
’This object stores the authentication values
Dim basicAuthenticationInfo As _
   New System.Net.NetworkCredential("username", "password")
’Put your own, or your ISPs, mail server name onthis next line
mailClient.Host = "Mail.RemoteMailServer.com"
mailClient.UseDefaultCredentials = False
mailClient.Credentials = basicAuthenticationInfo
mailClient.Send(Email)


0
投稿

猜你喜欢

手机版 网络编程 asp之家 www.aspxhome.com