Could anyone help me regarding my issue in vb.net to connect in gmail. I have created a tool that can connect to GMAIL using IMAP the tool can retrieve gmail email and load it to my listview and all other functionalities is working well, until I tried to test it in client's production area.
The URL of their gmail is "mail.google.com" which gives me an error. I tried to access the gmail site manually and I found out that every time I tried to access "gmail.com" it always redirect to "mail.google.com", while in my laptop I have an internet that can access everything and gmail.com is working fine. I tried to change the URL that you can see in my below source code to "imap.mail.google.com" it keeps me having an error. I hope you can help me thanks in advance!
Imports System.Globalization
Imports System.Text
Imports System.IO
Imports EAGetMail
Imports System.Data
Imports System.Net.Mail
Public Sub TestConnection(ByVal strUser As String, ByVal strPass As String)
Try '
Dim oServer As New MailServer("imap.gmail.com",
strUser,
strPass,
ServerProtocol.Imap4)
' Enable SSL/TLS connection, most modern email server require SSL/TLS connection by default.
oServer.SSLConnection = True
' Set 993 IMAP SSL Port
oServer.Port = 993
Dim oClient As New MailClient("TryIt")
oClient.Connect(oServer)
Dim infos As MailInfo() = oClient.GetMailInfos()
MsgBox("Connection Success")
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub