Exemplo n.º 1
0
        /// <summary>
        /// Gets the emails.
        /// </summary>
        /// <param name="provider">The provider.</param>
        /// <param name="userId">The user id.</param>
        /// <param name="pwd">The PWD.</param>
        /// <returns></returns>
        /// <exception cref="System.NotImplementedException"></exception>
        public List<Email> GetEmails(EmailProviderType provider, string userId, string pwd)
        {
            List<Email> emails = new List<Email>();
            if (provider == EmailProviderType.Gmail || provider == EmailProviderType.All)
            {
                using (var client = ProviderFactory.Get(provider))
                {
                    emails.AddRange(((GmailClient)client).GetEmails(userId, pwd));
                };
            }
            if (provider == EmailProviderType.Hotmail || provider == EmailProviderType.All)
            {
                using (var client = ProviderFactory.Get(provider))
                {
                    emails.AddRange(((HotmailClient)client).GetEmails(userId, pwd));
                };
            }
            if (provider == EmailProviderType.Yahoo || provider == EmailProviderType.All)
            {
                using (var client = ProviderFactory.Get(provider))
                {
                    emails.AddRange(((YahooClient)client).GetEmails(userId, pwd));
                };
            }

            return emails;
        }
        public IEmailProvider GetEmailProvider(EmailProviderType providerType)
        {
            switch (providerType)
            {
            case EmailProviderType.SendGrid:
                _emailProvider = new SendGridEmailProvider(_backgroundJobClient, _sendGridSettings);
                break;

            default:
                _emailProvider = new DefaultEmailProvider();
                break;
            }
            return(_emailProvider);
        }
Exemplo n.º 3
0
        public IEmailProvider Create(EmailProviderType type)
        {
            switch (type)
            {
            case EmailProviderType.Gmail:
                return(kernel.Get <GmailEmailProvider>());

            case EmailProviderType.OutlookWeb:
                return(kernel.Get <OutlookWebEmailProvider>());

            default:
                return(kernel.Get <MapIEmailProvider>());
            }
        }
Exemplo n.º 4
0
        public static IDisposable Get(EmailProviderType typeofProvider)
        {
            if (typeofProvider == EmailProviderType.Gmail)
            {
                return new GmailClient();
            }

            if (typeofProvider == EmailProviderType.Yahoo)
            {
                return new YahooClient();
            }

            if (typeofProvider == EmailProviderType.Hotmail)
            {
                return new HotmailClient();
            }

            return null;
        }
 public async Task <EmailProvider?> GetAsync(EmailProviderType id, CancellationToken ct) =>
 await _dbContext.EmailProviders.Find(Builders <EmailProvider> .Filter.Eq(x => x.Id, id))
 .FirstOrDefaultAsync(ct);
Exemplo n.º 6
0
 /// <summary>
 /// Sends the email.
 /// </summary>
 /// <param name="provider">The provider.</param>
 /// <param name="email">The email.</param>
 /// <param name="userId">The user id.</param>
 /// <param name="pwd">The PWD.</param>
 /// <returns></returns>
 /// <exception cref="System.NotImplementedException"></exception>
 public List<Contact> SendEmail(EmailProviderType provider, Email email, string userId, string pwd)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 7
0
 /// <summary>
 /// Gets the contacts.
 /// </summary>
 /// <param name="provider">The provider.</param>
 /// <param name="userId">The user id.</param>
 /// <param name="pwd">The PWD.</param>
 /// <returns></returns>
 /// <exception cref="System.NotImplementedException"></exception>
 public List<Contact> GetContacts(EmailProviderType provider, string userId, string pwd)
 {
     throw new NotImplementedException();
 }