Concern to API tool

Peter_1985 2,586 Reputation points


Is there any existing API tool, to be embedded on an ASP page, to receive/send mails on the designated domain, with Email service?

Windows Server
Windows Server
A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.
12,595 questions
ASP.NET: A set of technologies in the .NET Framework for building web applications and XML web services.API: A software intermediary that allows two applications to interact with each other.
317 questions
{count} votes

5 answers

Sort by: Most helpful
  1. SurferOnWww 2,411 Reputation points

    Is there any existing API tool, to be embedded on an ASP page, to receive/send mails on the designated domain, with Email service?

    How about SendGrid introduced in the Microsoft document Account confirmation and password recovery in ASP.NET Core?

    0 comments No comments

  2. Neuvi Jiang 690 Reputation points Microsoft Vendor

    Hi Peter_1985,

    Thank you for posting in the Q&A Forums.

    In ASP.NET or ASP.NET Core, sending and receiving emails typically involves using the SMTP, POP3, or IMAP protocols, along with the corresponding libraries or APIs. There are no API tools directly embedded on an ASP page to accomplish these tasks, but you can integrate these libraries and APIs to achieve the desired functionality.

    Please note that security and privacy are very important when handling email. Ensure that your application follows best security practices and protects users' privacy and data.

    Best regards



    If the Answer is helpful, please click "Accept Answer" and upvote it.

  3. AgaveJoe 27,656 Reputation points

    Does it mean we directly retrieve the mail details from the mail server, right?

    The first step is checking with your email provider. You want find out of your provider has an API. Then learn how the API works by reads their docs. If the email provider does not have an API then you can look into POP3 and IMAP protocol for reading emails.

    POP3 only allows downloading email messages from the server to the client. With IMAP, the emails messages are stored on the server and your code can interact with the server. To learn about IMAP or POP3 or find if anyone has written an IMAP or POP3 client in C# you can search GitHub or do a Google search.

    0 comments No comments

  4. Lan Huang-MSFT 28,836 Reputation points Microsoft Vendor

    Hi @Peter_1985,

    Sorry, you didn't mention your .NET Framework version before, so I assumed you were using the latest version.

    MailKit is not compatible with .NET Framework 4.5.

    User's image

    You can try the following method instead.

    Sending emails in C# with SMTP

     MailAddress to = new MailAddress("****");
     MailAddress from = new MailAddress("***");
     MailMessage message = new MailMessage(from, to)
         Subject = "Good morning, Elizabeth",
         Body = "Elizabeth, Long time no talk. Would you be up for lunch in Soho on Monday? I'm paying."
     SmtpClient client = new SmtpClient("smtp.server.address", 2525)
         Credentials = new NetworkCredential("smtp_username", "smtp_password"),
         EnableSsl = true
     // code in brackets above needed if authentication required
     catch (SmtpException ex)

    Receiving emails is not a part of core C# stack so you will need to utilize some 3rd party libraries for that purpose. OpenPop.NET open-source library seems to be getting the job done in this case. You can use the following code to fetch the topics of incoming mail:

    var client = new Pop3Client();
     client.Connect("", 995, true);
     client.Authenticate("", "My_password_here");
     var count = client.GetMessageCount();
     Message message = client.GetMessage(count);

    Best regards,
    Lan Huang

    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

  5. Peter_1985 2,586 Reputation points

    I want to know the reason to the following. Currently, I am using (not Must I use


    The server did not respond with a + response. The response was: "220 ESMTP"

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: OpenPop.Pop3.Exceptions.PopServerException: The server did not respond with a + response. The response was: "220 ESMTP"

    Source Error:

    Line 527: var client = new Pop3Client();

    Line 528: client.Connect("", 587, false);

    Line 529: client.Authenticate("", "?");