You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have mentioned the code below which is working fine for Gmail but not giving any notification in case of outlook account.
private void StartIdleProcess(object sender, DoWorkEventArgs e)
{
// Get the BackgroundWorker that raised this event.
//BackgroundWorker worker = sender as BackgroundWorker;
try
{
if (imap != null && imap.IsConnected)
{
imap.StopIdle();
imap.Disconnect();
}
var handShake = new ActiveUp.Net.Security.SslHandShake("imap-mail.outlook.com", System.Security.Authentication.SslProtocols.Default);
handShake.ServerCertificateValidationCallback = delegate { return true; };
imap = new Imap4Client();
imap.NewMessageReceived += new NewMessageReceivedEventHandler(NewMessageReceived);
imap.ConnectSsl("imap-mail.outlook.com", 993);
var res = imap.Login(@OutlookID, @Password);
imap.SelectMailbox("inbox");
imap.StartIdle();
_log.Info("Connected");
}
catch (Exception ex)
{
}
}
public static void NewMessageReceived(object source, NewMessageReceivedEventArgs e)
{
//thisForm.AddLogEntry("New message received :" + e.MessageCount);
_log.Info("Message Received");
//imap4.StopIdle();
}
After sometime it is giving "Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host." this exception.
The text was updated successfully, but these errors were encountered:
I have mentioned the code below which is working fine for Gmail but not giving any notification in case of outlook account.
After sometime it is giving "Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host." this exception.
The text was updated successfully, but these errors were encountered: