Hello ,
I am using this code to send an E-mail from a Gmail account :
CODE
Dim SmtpServer As New SmtpClient()
SmtpServer.Credentials = New Net.NetworkCredential("xxx@gmail.com", "password")
'SmtpServer.Credentials = New Net.w
SmtpServer.Port = 587
SmtpServer.Host = "smtp.gmail.com"
SmtpServer.EnableSsl = True
mail = New MailMessage()
Dim addr() As String = TextBox1.Text.Split(",")
Try
mail.From = New MailAddress("xxx@gmail.com", "Web Developers", System.Text.Encoding.UTF8)
Dim i As Byte
For i = 0 To addr.Length - 1
mail.To.Add(addr(i))
Next
mail.Subject = TextBox3.Text
mail.Body = TextBox4.Text
If ListBox1.Items.Count <> 0 Then
For i = 0 To ListBox1.Items.Count - 1
mail.Attachments.Add(New Attachment(ListBox1.Items.Item(i)))
Next
End If
mail.DeliveryNotificationOptions = DeliveryNotificationOptions.OnFailure
mail.ReplyTo = New MailAddress(TextBox1.Text)
SmtpServer.Send(mail)
Catch ex As Exception
MsgBox(ex.ToString())
End Try
When I use the broadband connection at home , all work fine . However when I use the wireless connection at uni , It gives me always an error that it cannot connect to host and cant send the message !!!
Any idea ?!
J ,