Example #1
0
        public static async Task SendEmailAsync(EmailHost host, string login, string password, MimeMessage message)
        {
            using (var client = new SmtpClient())
            {
                client.ServerCertificateValidationCallback = (s, c, h, e) => true;
                await client.ConnectAsync(host.Url, host.Port, false);

                await client.AuthenticateAsync(login, password);

                await client.SendAsync(message);

                await client.DisconnectAsync(true);
            }
        }
        public async void SendListAsync(string email, Logic.Entry[] entries)
        {
            try
            {
                var host  = new EmailHost(await Configuration.GetMailingSmtpHost(), await Configuration.GetMailingSmtpPort());
                var login = await Configuration.GetMailingAccountLogin();

                var password = await Configuration.GetMailingAccountPassword();

                var message = CreateListMessage(email, login, entries);
                await EmailHelper.SendEmailAsync(host, login, password, message);
            }
            catch
            {
                // ignored
            }
        }