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