Mailing send error due to ... !!!
-
Hello , I am using this code to send an E-mail from a Gmail account : 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("bankersystem@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 ,
-
Hello , I am using this code to send an E-mail from a Gmail account : 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("bankersystem@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 ,
Hi, When you say it works at home? Alarm bell should be ringing here! if it works what are you doing differently at uni, i.e. are you using a wired connection at home and a wireless connection at uni etc... Many uni's have proxy servers and this could also be an issue - you need to take the uni out of the equation try it on a different wireless network and eliminate the problem down. To test your code try and a do a simple web request i.e get the html or a website,you can get the code off google, if it this in both places then this tells you you can acces the web your uni's proxy if not then its got to be your code, and you may have to pass up them credentials also. Andy
-
Hi, When you say it works at home? Alarm bell should be ringing here! if it works what are you doing differently at uni, i.e. are you using a wired connection at home and a wireless connection at uni etc... Many uni's have proxy servers and this could also be an issue - you need to take the uni out of the equation try it on a different wireless network and eliminate the problem down. To test your code try and a do a simple web request i.e get the html or a website,you can get the code off google, if it this in both places then this tells you you can acces the web your uni's proxy if not then its got to be your code, and you may have to pass up them credentials also. Andy