This is your example code. How to connect to gmail.
private void DoMethod ()
{
bool connecting = false;
Exception error;
try
{
if (_pop.State == Pop3State.Disconnected)
{
connecting = true;
// Get configuration.
string server = _config.GetString("server");
int port = _config.GetInt32("port");
string userName = _config.GetString("userName");
string password = _config.GetString("password");
SetStatus(string.Format("Connecting to {0}...", server));
// Forget the old message list.
_messageList = null;
// Connect to the server.
_pop.Connect(server, port);
_pop.Login(userName, password);
connecting = false;
}
// Run desired background operation.
_method ();
error = null;
}
catch (Exception x)
{
Pop3Exception px = x as Pop3Exception;
if (px != null && px.Status == Pop3ExceptionStatus.OperationAborted)
{
// If the operation is a result of an abort, don't report it as error.
error = null;
_pop.Disconnect();
}
else
{
error = x;
// If this is a failed connection attempt, disconnect.
if (connecting)
_pop.Disconnect();
}
}
finally
{
_thread = null;
}
// Resets status bar and informs the main form that the operation finished.
SetStatus("");
if (_callback != null)
_owner.SafeInvoke(_callback, new object[] {error});
}
when i tried to connect with trial version of Rebex mail i do this succeed
with this code:
// connect and log in
Pop3 client = new Pop3();
client.Connect("pop.gmail.com", 995, null, Pop3Security.Implicit);
client.Login(email, password);
// process messagess...
// logount and disconnect
client.Disconnect();
after i purchased the normal version. i don't have this method:
client.Connect("pop.gmail.com", 995, null, Pop3Security.Implicit);
i have only this:
// Connect to the server.
_pop.Connect(server, port);
and i think that gmail need secure connection.
please help me connect to gmail.