diff --git a/src/MailKitMailModule.cs b/src/MailKitMailModule.cs index 79e5750..51719f1 100644 --- a/src/MailKitMailModule.cs +++ b/src/MailKitMailModule.cs @@ -12,7 +12,9 @@ using OpenSim.Region.Framework.Scenes; using System; using System.Collections.Generic; using System.Linq; +using System.Net.Security; using System.Reflection; +using System.Security.Cryptography.X509Certificates; using System.Text; using System.Threading.Tasks; using System.Timers; @@ -110,7 +112,7 @@ namespace OpenSim.Modules.EMail SMTP_SERVER_SENDER = m_config.Configs["Mail"].GetString("SMTP_SERVER_SENDER", ""); IMAP_SERVER_HOSTNAME = m_config.Configs["Mail"].GetString("IMAP_SERVER_HOSTNAME", String.Empty); - IMAP_SERVER_PORT = m_config.Configs["Mail"].GetInt("IMAP_SERVER_PORT", 25); + IMAP_SERVER_PORT = m_config.Configs["Mail"].GetInt("IMAP_SERVER_PORT", 143); IMAP_SERVER_SSL = m_config.Configs["Mail"].GetBoolean("IMAP_SERVER_SSL", false); IMAP_SERVER_TLS = m_config.Configs["Mail"].GetBoolean("IMAP_SERVER_TLS", false); IMAP_SERVER_LOGIN = m_config.Configs["Mail"].GetString("IMAP_SERVER_LOGIN", String.Empty); @@ -130,7 +132,7 @@ namespace OpenSim.Modules.EMail } #endregion - private void checkForMails(object sender, ElapsedEventArgs e) + private void checkForMails(object sender, ElapsedEventArgs f) { try { @@ -139,6 +141,8 @@ namespace OpenSim.Modules.EMail using (var client = new ImapClient()) { client.CheckCertificateRevocation = false; + client.Timeout = 5000; + client.ServerCertificateValidationCallback = (s, c, h, e) => true; if (IMAP_SERVER_SSL == true) { @@ -160,9 +164,9 @@ namespace OpenSim.Modules.EMail { m_log.Info("[" + Name + "] Login with " + IMAP_SERVER_LOGIN + ";" + IMAP_SERVER_PASSWORD); client.Authenticate(IMAP_SERVER_LOGIN, IMAP_SERVER_PASSWORD); + } - IMailFolder IMAPInbox = client.Inbox; IMAPInbox.Open(FolderAccess.ReadWrite);