发邮件

来源:互联网 发布:好大夫软件下载 编辑:程序博客网 时间:2024/06/09 23:55

Private Sub Page_Load(sender As Object, e As System.EventArgs)
   Dim mail As New MailMessage()
   mail.To = "me@mycompany.com"
   mail.From = "you@yourcompany.com"
   mail.Subject = "this is a test email."
   mail.Body = "Some text goes here"
   mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1") 'basic authentication
   mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", "my_username_here") 'set your username here
   mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "super_secret") 'set your password here
   SmtpMail.SmtpServer = "mail.mycompany.com" 'your real server goes here
   SmtpMail.Send(mail)
End Sub 'Page_Load


原创粉丝点击