Getting Error SMTP server has unexpectedly disconnected.

Sanjay Bhakuni 20 Reputation points
2024-10-28T02:45:02.51+00:00

While sending email from Mailkit application using SMTP relay getting error SMTP server has unexpectedly disconnected. Please find the attached screenshot for the reference.

image (35)

Exchange Online
Exchange Online
A Microsoft email and calendaring hosted service.
6,171 questions
0 comments No comments
{count} votes

Accepted answer
  1. Anonymous
    2024-10-28T08:45:01.6166667+00:00

    Hello, @Sanjay Bhakuni,

    Welcome to the Microsoft Q&A platform!

    Based on your description, you are encountering an issue with the SMTP relay in your Mailkit application. This error can occur due to various reasons. Here are a few steps you can take to troubleshoot and resolve the issue:

    1.Credentials: Ensure that the username and password for the SMTP server are correct. Make sure that the credentials have the necessary permissions to send emails.

    2.Network Issues: Verify that there are no network issues or firewall settings blocking the connection to the SMTP server. Network interruptions can cause the server to disconnect unexpectedly.

    3.SMTP Server Settings: Double-check the SMTP server settings, including the hostname, port, and authentication details. A typo or incorrect setting can lead to disconnections.

    4.SSL/TLS Configuration: Ensure that you’re using the correct SSL/TLS settings for the SMTP server. For example, if you’re connecting to a port that requires SSL (like port 465), make sure SSL is enabled in your MailKit configuration.

    5.SMTP Server Limits: Check if the SMTP server has any limits on the number of connections or the rate of sending emails. Exceeding these limits can result in disconnections.

    6.Gmail Specific Issues: If you’re using Gmail, ensure that you have enabled “Less secure app access” or use an app-specific password if two-step verification is enabled.

    7.Enable Logging: Enable logging in your Mailkit application to capture detailed information about the error. This can help identify the root cause of the disconnection.

    8.Mailkit Configuration: Ensure that the Mailkit application is updated to the latest version, as updates may fix bugs or improve compatibility.


    If the answer is helpful please click on ACCEPT ANSWER as it could help other members of the Microsoft Q&A community who have similar questions and are looking for solutions.

    Thank you for your support and understanding.

    Best Wishes,

    Alex Zhang


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.