Notify C# Client, when SMTP Server receive a new Email

前端 未结 3 629
星月不相逢
星月不相逢 2020-12-08 20:55

I want to get all emails in my ASP.NET application that have a certain CC-recipient. To use this for future emails I didn\'t want to polling all the time to get them. But I

3条回答
  •  被撕碎了的回忆
    2020-12-08 21:54

    You are approaching this from the wrong angle.

    SMTP does not support receiving mail (never mind PUSH mail). POP3 is what you can use for retrieving mail, but it does not have support for PUSH either (so you would have to pull for mail).

    The IMAP4 IDLE extension is what most refer to as PUSH mail - so you will need to find a library for C# that supports IMAP4 IDLE. I found some information that will get you going in the right direction (no reason to duplicate it here):

    • Using C# .Net Libraries to Check for IMAP Messages
    • Accessing IMAP in C#

    Keep in mind when choosing a solution that it needs to support IDLE. I really like the look of MailSystem.Net as it fulfills your requirements.

    Remember that your mail server also needs to have IMAP4 and IMAP4 IDLE enabled. Some mail servers don't support it, so you might be clean out of luck (and will have to use POP3 pulling).

提交回复
热议问题