amrelgarhy81
asked on
Access Gmail with Indy
Hello
I am trying to use Indy "http//:www.indyproject.org" to read mails from my gmail.
In a .Net 2.0 windows application.
I added the Indy dll file and i can access my company mail but not the gmail.
My gmail allow pop3.
The problem is that gmail needs ssl and don't know how to do using indy.
Any one tell me the problem in my code?
I am trying to use Indy "http//:www.indyproject.org" to read mails from my gmail.
In a .Net 2.0 windows application.
I added the Indy dll file and i can access my company mail but not the gmail.
My gmail allow pop3.
The problem is that gmail needs ssl and don't know how to do using indy.
Any one tell me the problem in my code?
Indy.Sockets.POP3 nn = new Indy.Sockets.POP3();
nn.Username = "myMail@gmail.com";
nn.Password = "mypassword";
Indy.Sockets.POP3AuthenticationType.atUserPass;
// Indy.Sockets.TIdIOHandlerTls ioSSLHandler = new Indy.Sockets.TIdIOHandlerTls();
//ioSSLHandler.PassThrough = false;
// ioSSLHandler.Options.Protocol = Mono.Security.Protocol.Tls.SecurityProtocolType.Tls;
// nn.IOHandler = ioSSLHandler;
nn.Connect("pop.gmail.com", 995);
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
i did that, but it keep connecting and hang my application without any response.
the first link i posted shows how to use gmail with indy
ASKER
Look
I wrote it like that and its not working with me, it keep connecting without any response.
I wrote it like that and its not working with me, it keep connecting without any response.
private void ConnectToGMail()
{
Indy.Sockets.POP3 nn = new Indy.Sockets.POP3();
nn.Username = "UserEmail";
nn.Password = "password";
nn.Host = "pop.gmail.com";
nn.Port = 995;
nn.OnStatus += new Indy.Sockets.TIdStatusEvent(nn_OnStatus);
Indy.Sockets.TIdIOHandlerTls ioSSLHandler = new Indy.Sockets.TIdIOHandlerTls();
ioSSLHandler.PassThrough = false;
ioSSLHandler.Options.Protocol = Mono.Security.Protocol.Tls.SecurityProtocolType.Tls;
nn.IOHandler = ioSSLHandler;
nn.UseTLS = Indy.Sockets.UseTLS.utUseExplicitTLS;
nn.Connect();
}
void nn_OnStatus(object ASender, Indy.Sockets.Status AStatus, string AStatusText)
{
MessageBox.Show(AStatusText);
}
ASKER
I put them in the application path, but i think i should change somthing in the the code.
You have an idea?