Click here to Skip to main content
12,895,062 members (53,722 online)
Rate this:
Please Sign up or sign in to vote.
See more: VB VB.NET
i want to create a application that send email via gmail, but does not work.
I tried to see if I reached the server on port 465 via telnet (telnet 465) and this works.
Thanks in advance for your help

this is code:
Sub Main()
Dim SmtpServer As New SmtpClient()
SmtpServer.Port = 465
SmtpServer.Host = ""
SmtpServer.EnableSsl = True
SmtpServer.UseDefaultCredentials = False
SmtpServer.Timeout = 8000
SmtpServer.Credentials = New Net.NetworkCredential("", "Password")

Dim m As New MailMessage
'm.From = New MailAddress("")
m.Body = "Test Message"
m.Subject = "Test Subject"
Catch ex As Exception
End Try

End Sub
Posted 18-Feb-13 23:17pm

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 2

Try with
SmtpServer.Port = 587
gianLuca1978 19-Feb-13 5:31am
thanks for your reply, however i have tried with the port 587 but i received immediately the error, while if i use a port 465 i received error before the timeout. then i try a "telnet 587" and the connection is refused.
Prasad_Kulkarni 19-Feb-13 5:34am
You're welcome.

Please check this Similar thread[^], hope you get some help out.
gianLuca1978 19-Feb-13 5:55am
thanks now I'll try to do some thinking on this post.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

    Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web01 | 2.8.170424.1 | Last Updated 19 Feb 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100