Disha Sharma
Disha Sharma

Reputation: 11

The SMTP server has unexpectedly disconnected

My application(developed in .net core and hosted on azure) has email client feature. My clients tries to configure yahoo accounts by managing app password but after successful configuration, they face incorrect password and exception logged behind it is "MailKit.Net.Smtp.SmtpProtocolException: The SMTP server has unexpectedly disconnected." while sending email, and if want to resolve this, we need to generate a new app password. we are using Maikit to send email. Please help me, which will be appreciable.


Following settings I used: smtp.mail.yahoo.com

Port Number: 465 (With SSL)

Also tried port 587 without SSL


Problem comes on

client.Authenticate(emailCredentials.UserName, emailCredentials.Password);

Upvotes: 1

Views: 6145

Answers (1)

jstedfast
jstedfast

Reputation: 38528

That exception doesn't mean that the username or password is wrong, it means you lost your TCP/IP connection with the server.

You need to reconnect and try again.

If you keep losing the connection, either your network connection is bad or the server has blacklisted your client's IP address.

Upvotes: -1

Related Questions