Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
GMail blues
Message
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Titre:
Versions des environnements
Environment:
VB 9.0
OS:
Windows 7
Network:
Windows NT
Database:
Jet/Access Engine
Application:
Desktop
Divers
Thread ID:
01570810
Message ID:
01570819
Vues:
52
I would start with looking into an error message/status which should be in client properties, I guess

>This code works on all the sites where I have installed it, except in some. The client.send() just fails. I guess this is firewall issue. I there anyway one can figure out why the client.send fails?
>
>Thanks (Sergey :) ).
>
>
>
>    Public Sub SendEmail(ByVal subject As String, ByVal messageBody As String, _
>     ByVal fromAddress As String, ByVal toAddress As String, ByVal ccAddress As String)
>
>        Dim message As New MailMessage()
>        Dim client As New SmtpClient()
>
>        'Set the sender's address
>        message.From = New MailAddress(fromAddress)
>        'Allow multiple "To" addresses to be separated by a semi-colon
>        If (toAddress.Trim.Length > 0) Then
>            For Each addr As String In toAddress.Split(";"c)
>                message.To.Add(New MailAddress(addr))
>            Next
>        End If
>
>        'Allow multiple "Cc" addresses to be separated by a semi-colon
>        If (ccAddress.Trim.Length > 0) Then
>            For Each addr As String In ccAddress.Split(";"c)
>                message.CC.Add(New MailAddress(addr))
>            Next
>        End If
>        'Set the subject and message body text
>        message.Subject = subject
>        message.IsBodyHtml = False
>        message.Body = messageBody
>
>        client.Host = "smtp.gMAIL.com"
>        client.Credentials = New System.Net.NetworkCredential("***@gmail.com", "***")
>        'client.Port = 587
>        client.Port = 465
>        client.EnableSsl = True
>        'Send the e-mail message
>        Dim l As Boolean = False
>        Try
>            client.Send(message)
>        Catch
>            l = True
>        End Try
>        If l Then
>            MsgBox("Send failure")
>        Else
>            MsgBox("OK")
>        End If
>    End Sub
>
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform