public async Task <SmtpResult> SendAsync(MimeMessage mimeMessage, CancellationToken cancellationToken)
        {
            var result = new SmtpResult();

            var settings      = _smtpOptions.Value;
            var disposableBag = new DisposableBag();
            var logStream     = disposableBag.Create <MemoryStream>();

            var host   = settings.Host;
            var port   = settings.Port;
            var useSsl = settings.UseSSL;

            var userName = settings.UserName;
            var password = settings.Password;

            try
            {
                // make sure there is a from address
                if (mimeMessage.From.Count == 0)
                {
                    mimeMessage.From.Add(new MailboxAddress(settings.FromName, settings.FromAddress));
                }

                var logger = disposableBag.Create(() => new ProtocolLogger(logStream));
                var client = disposableBag.Create(() => new SmtpClient(logger));

                // accept all SSL certificates
                client.ServerCertificateValidationCallback = (s, c, h, e) => true;

                await client.ConnectAsync(host, port, useSsl, cancellationToken).ConfigureAwait(false);

                // fix gmail issues
                client.AuthenticationMechanisms.Remove("XOAUTH2");

                if (userName.HasValue() || password.HasValue())
                {
                    await client.AuthenticateAsync(userName, password, cancellationToken).ConfigureAwait(false);
                }

                await client.SendAsync(mimeMessage, cancellationToken).ConfigureAwait(false);

                await client.DisconnectAsync(true, cancellationToken).ConfigureAwait(false);

                result.Successful = true;
            }
            catch (Exception ex)
            {
                result.Successful = false;
                result.Exception  = ex;
            }
            finally
            {
                logStream.Position = 0;

                var reader = disposableBag.Create(() => new StreamReader(logStream));

                result.SmtpLog = await reader
                                 .ReadToEndAsync()
                                 .ConfigureAwait(false);


                disposableBag.Dispose();

                LogResult(mimeMessage, result, host);
            }

            return(result);
        }