| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 | using InABox.Core;using InABox.Mail;using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;namespace InABox.API{    public class IMAPProvider : ISMSProvider    {        private IMAPMailer Mailer;        public SMSProviderType ProviderType => SMSProviderType.IMAP;        public TwoFactorAuthenticationType TwoFactorAuthenticationType => TwoFactorAuthenticationType.Email;        public IMAPProvider(string host, int port, string username, string password)        {            Mailer = new IMAPMailer()            {                SMTPHost = host,                SMTPPort = port,                SMTPUserName = username,                SMTPPassword = password            };        }        public bool SendMessage(string recipient, string message)        {            try            {                var imapMessage = Mailer.CreateMessage();                imapMessage.Subject = "Message from PRS";                imapMessage.Body = message;                imapMessage.IsHTML = false;                imapMessage.To = new List<string> { recipient };                Mailer.SendMessage(imapMessage);            }            catch (Exception)            {                return false;            }            return true;        }    }}
 |