Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

Mailkit 1.10.1 receive and empty string from smtp.gmail.com

$
0
0

Hi,

Help needed!

smtp.gmail.com return an empty string after the mail is sent and my app stop showing a blank page:
you can try https://parogsingler.dk/Home/Kontakt
Stopping at https://parogsingler.dk/Home/SendEmailAsync

My code:
 using (var client = new SmtpClient())
            {
                var credentials = new NetworkCredential
                {
                    UserName = "admin@parogsingler.dk", // replace with valid value
                    Password = "xxxxxx" // replace with valid value
                };
                client.LocalDomain = "parogsingler.dk";
                // check your smtp server setting and amend accordingly:
                client.Connect("smtp.gmail.com", 587, SecureSocketOptions.Auto);
                client.AuthenticationMechanisms.Remove("XOAUTH2");
                await client.AuthenticateAsync(credentials);
                await client.SendAsync(emailMessage).ConfigureAwait(false);
                await client.DisconnectAsync(true).ConfigureAwait(false);

                RedirectToAction("Thanks");
            }
Any clues about this?
Regards,
Poul Erik


Viewing all articles
Browse latest Browse all 9386

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>