static async void OnNewMessage (object sender, IdleMessageEventArgs e) { MailMessage Message = Client.GetMessage (e.MessageUID); if (Message.Body.Contains ("Angriffswarnung")) { await Task.Run (() => Irc.FilterEmail (Message)); } }
private void InternalClientOnIdleError(object sender, IdleMessageEventArgs idleMessageEventArgs) { if (NewMessageInternal != null) NewMessageInternal(sender, new IdleMessageEventArgsWrapper(this)); }
private void OnNewMessage(object sender, IdleMessageEventArgs e) { var m = e.Client.GetMessage(e.MessageUID,false); var d = Convert.ToDateTime(m.Headers.Get("Date")); var indice = dataGridView1.Rows.Add(m.From, m.Subject, d); dataGridView1.Rows[indice].Tag = m; dataGridView1.Sort(dataGridView1.Columns[2], System.ComponentModel.ListSortDirection.Descending); dataGridView1.Refresh(); }
private void ImapClientNewMessage(object sender, IdleMessageEventArgs e) { }
private void OnNewMessage(object sender, IdleMessageEventArgs e) { string mailFolder = Directory.GetCurrentDirectory() + "\\" + AppStateSettings.Instance.Config.Get("ReceiveMailPlugin.Folder", "\\Presenter\\"); if (!mailFolder.EndsWith("\\")) mailFolder += "\\"; if (!Directory.Exists(mailFolder)) Directory.CreateDirectory(mailFolder); if (!Directory.Exists(mailFolder)) return; // Fetch the new message's headers and print the subject line MailMessage m = e.Client.GetMessage(e.MessageUID, FetchOptions.Normal); if (m.Attachments.Any()) { foreach (Attachment a in m.Attachments) { try { byte[] bytes = default(byte[]); using (var memstream = new MemoryStream()) { a.ContentStream.CopyTo(memstream); bytes = memstream.ToArray(); } string f = mailFolder + DateTime.Now.Ticks + "-" + a.Name; File.WriteAllBytes(f, bytes); if (AppState.Config.GetBool("ReceiveMailPlugin.ShowDirectly", false)) { var fe = FloatingHelpers.CreateFloatingElement(new Document() {Location = f, OriginalUrl = f}); AppState.FloatingItems.AddFloatingElement(fe); } Execute.OnUIThread( () => { NotificationEventArgs nea = AppState.TriggerNotification("New file received from " + m.From.Address); }); } catch (Exception exception) { Logger.Log("ReceiveMailPlugin","Error save incoming message", exception.Message,Logger.Level.Error); } } } }
void ImapConnection_NewMessage(object sender, IdleMessageEventArgs e) { this.recievedMessage(e.MessageUID); }