vb.net2010发送邮件

来源: www.zngps.com| 2017-08-24 16:39
    Private Sub Button2_Click(sender As System.Object, e As System.EventArgs) Handles Button2.Click
        Dim smtp As New System.Net.Mail.SmtpClient("smtp.126.com", 25)
        smtp.Credentials = New System.Net.NetworkCredential("发件邮箱", "密码") ' ----->这里有smtp验证 
        Dim mail As New System.Net.Mail.MailMessage()
        mail.Subject = "主题"
        mail.SubjectEncoding = System.Text.Encoding.GetEncoding("GB2312")
        mail.BodyEncoding = System.Text.Encoding.GetEncoding("GB2312")
        mail.From = New System.Net.Mail.MailAddress("qhanchen@126.com")
        mail.Priority = System.Net.Mail.MailPriority.Normal
        mail.IsBodyHtml = True
        mail.Body = "内容"
        mail.To.Add("342024838@qq.com")
        smtp.Send(mail)
    End Sub

猜你喜欢
推荐
随机推荐
相关文档
月排行文档
Top