发送电子邮件VB 2012

时间:2013-08-30 14:23:16

标签: email smtp send

我必须从我的VB 2012应用程序发送一封电子邮件,我尝试了我在网上找到的不同功能。 我使用System.Net.Mail库使用了MailAddress,SmtpClient ecc。 该应用程序没有给我任何例外,但没有发送电子邮件。 与VB 2010应用程序相同的功能也完美地在2012 IDE中执行。我不明白为什么=( 看看我的功能

Private Sub InviaMailProva2(ByVal SmtpServer As String, ByVal usermail As String, ByVal sender As String, ByVal password As String, ByVal receiver As String, ByVal subject As String, ByVal body As String)
    Dim email As New MailMessage
    Dim smtp As New SmtpClient
    email.From = New MailAddress(usermail)
    email.Subject = subject
    email.To.Add(receiver)
    smtp.Port = 25     'i use an aruba email, it work with other application'
    smtp.Host = SmtpServer
    smtp.Credentials = New Net.NetworkCredential(user, password)
    smtp.Send(email)
End Sub

0 个答案:

没有答案