add error handling
parent
5a6179ed6e
commit
649829f307
|
@ -70,6 +70,8 @@ namespace OpenSim.Modules.EMail
|
|||
scene.RegisterModuleInterface<IEmailModule>(this);
|
||||
m_scene = scene;
|
||||
|
||||
if(IMAP_SERVER_HOSTNAME != String.Empty)
|
||||
{
|
||||
m_timer = new Timer();
|
||||
|
||||
m_timer.Interval = 1000 * 60;
|
||||
|
@ -77,6 +79,7 @@ namespace OpenSim.Modules.EMail
|
|||
m_timer.Enabled = true;
|
||||
m_timer.Start();
|
||||
}
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
|
@ -128,6 +131,8 @@ namespace OpenSim.Modules.EMail
|
|||
#endregion
|
||||
|
||||
private void checkForMails(object sender, ElapsedEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
m_log.Info("[" + Name + "] checkForMails");
|
||||
|
||||
|
@ -161,16 +166,16 @@ namespace OpenSim.Modules.EMail
|
|||
IMailFolder IMAPInbox = client.Inbox;
|
||||
IMAPInbox.Open(FolderAccess.ReadWrite);
|
||||
|
||||
m_log.Info("[" + Name + "] Found "+ IMAPInbox.Count + " messages.");
|
||||
m_log.Info("[" + Name + "] Found " + IMAPInbox.Count + " messages.");
|
||||
for (int i = 0; i < IMAPInbox.Count; i++)
|
||||
{
|
||||
MimeMessage message = IMAPInbox.GetMessage(i);
|
||||
|
||||
foreach(MailboxAddress adress in message.To.Mailboxes)
|
||||
foreach (MailboxAddress adress in message.To.Mailboxes)
|
||||
{
|
||||
SceneObjectPart sceneObject = m_scene.GetSceneObjectPart(adress.Address.Split('@')[0]);
|
||||
|
||||
if(sceneObject != null)
|
||||
if (sceneObject != null)
|
||||
{
|
||||
m_messages.Add(message);
|
||||
IMAPInbox.SetFlags(i, MessageFlags.Deleted, true);
|
||||
|
@ -182,6 +187,10 @@ namespace OpenSim.Modules.EMail
|
|||
IMAPInbox.Expunge();
|
||||
client.Disconnect(true);
|
||||
}
|
||||
}catch(Exception _error)
|
||||
{
|
||||
m_log.Error("[" + Name + "] " + _error.Message);
|
||||
}
|
||||
}
|
||||
|
||||
public void SendEmail(UUID objectID, string address, string subject, string body)
|
||||
|
|
Loading…
Reference in New Issue