diff --git a/src/MailKitMailModule.cs b/src/MailKitMailModule.cs index aecf41c..d9613b3 100644 --- a/src/MailKitMailModule.cs +++ b/src/MailKitMailModule.cs @@ -150,23 +150,31 @@ namespace OpenSim.Modules.EMail if (IMAP_SERVER_SSL == true) { - m_log.Info("[" + Name + "] Connect SSL"); + if (m_debug) + m_log.Info("[" + Name + "] Connect SSL"); + client.Connect(IMAP_SERVER_HOSTNAME, IMAP_SERVER_PORT, SecureSocketOptions.Auto); } else if (IMAP_SERVER_TLS == true) { - m_log.Info("[" + Name + "] Connect TLS"); + if (m_debug) + m_log.Info("[" + Name + "] Connect TLS"); + client.Connect(IMAP_SERVER_HOSTNAME, IMAP_SERVER_PORT, SecureSocketOptions.StartTlsWhenAvailable); } else { - m_log.Info("[" + Name + "] Connect None"); + if (m_debug) + m_log.Info("[" + Name + "] Connect None"); + client.Connect(IMAP_SERVER_HOSTNAME, IMAP_SERVER_PORT, SecureSocketOptions.None); } if (IMAP_SERVER_LOGIN != String.Empty && IMAP_SERVER_PASSWORD != String.Empty) { - m_log.Info("[" + Name + "] Login with " + IMAP_SERVER_LOGIN + ";" + IMAP_SERVER_PASSWORD); + if (m_debug) + m_log.Info("[" + Name + "] Login with " + IMAP_SERVER_LOGIN + ";" + IMAP_SERVER_PASSWORD); + client.Authenticate(IMAP_SERVER_LOGIN, IMAP_SERVER_PASSWORD); } @@ -174,7 +182,9 @@ namespace OpenSim.Modules.EMail IMailFolder IMAPInbox = client.Inbox; IMAPInbox.Open(FolderAccess.ReadWrite); - m_log.Info("[" + Name + "] Found " + IMAPInbox.Count + " messages."); + if (m_debug) + m_log.Info("[" + Name + "] Found " + IMAPInbox.Count + " messages."); + for (int i = 0; i < IMAPInbox.Count; i++) { MimeMessage message = IMAPInbox.GetMessage(i); @@ -188,7 +198,6 @@ namespace OpenSim.Modules.EMail m_log.Info("[" + Name + "] Objekt ID: " + adress.Address.Split('@')[0]); } - String UUIDString = adress.Address.Split('@')[0].Trim(); if(isUUID(UUIDString))