} //end method public static void checkEmail() { ComponentInfo.SetLicense("FREE-LIMITED-KEY"); using (PopClient pop = new PopClient("pop.gmail.com")) { // Connect and sign to POP server. pop.Connect(); pop.Authenticate(Ref.email, Ref.password); // Read the number of currently available emails on the server. int count = pop.GetCount(); Console.WriteLine(" NO. | DATE | MESSAGE "); Console.WriteLine("------------------------------------------------"); // Download and receive all email messages. try { for (int number = 1; number <= count; number++) { GemBox.Email.MailMessage message = pop.GetMessage(number); // Read and display email's date and subject. Console.WriteLine($" {number} | {message.Date.ToShortDateString()} | {message.BodyText}"); } } catch (Exception e) { Console.WriteLine(e.ToString()); } } }
private void timer3_Tick(object sender, EventArgs e) { // If using Professional version, put your serial key below. ComponentInfo.SetLicense("FREE-LIMITED-KEY"); // Create IMAP client. using (var imap = new ImapClient("imap-mail.outlook.com")) { // Connect and sign to IMAP server. imap.Connect(); imap.Authenticate("email", "passwd"); // Select INBOX folder. imap.SelectInbox(); DateTime dateNow = DateTime.Now; // Download and receive all email messages from selected mailbox folder. GemBox.Email.MailMessage message = imap.GetMessage(imap.SelectedFolder.Count); if (message.Subject.Contains("Armar")) { if (!alarmIsArmed) { K8055.OpenDevice(0); K8055.SetDigitalChannel(8); labelOpenDevice.BackColor = Color.Green; alarmIsArmed = true; textBoxLogs.Text += "[" + dateNow.ToString() + "]" + " Alarme Armado (Via Email)" + Environment.NewLine; } } if (message.Subject.Contains("Desarmar 1234") && alarmIsArmed) { // Stop sound alarmSound("stop"); // Clear Outputs K8055.ClearDigitalChannel(1); K8055.ClearDigitalChannel(2); // Close Device K8055.CloseDevice(); // Alterar a cor das labels para verde no mapa labelS1.BackColor = Color.Red; labelS2.BackColor = Color.Red; labelS3.BackColor = Color.Red; labelS4.BackColor = Color.Red; labelS5.BackColor = Color.Red; labelOpenDevice.BackColor = Color.Red; alarmIsArmed = false; alarmEnabled = false; externalArm = false; randomIlumination = false; timeToEnableExternal = 0; ringAlarmLog = 0; playTime = 10; textBoxLogs.Text += "[" + dateNow.ToString() + "]" + " Alarme Desarmado (Via Email)" + Environment.NewLine; } } }