How can I detect if my fetched email is bounced or not










1















I fetched emails from servers by using IMAP or POP3 and entered the fetched emails to database but I noticed there are a lot of bounced emails entered to the system so I searched a lot on google to check fetched email and if it's bounced email I'll not enter it to the system and I found library BounceDetectResult to detect if email is bounced or not but this library working only with message type MimeMessage so It's useful when I use IMAP but it's not work with message type OpenPop.Mime.Message so I can't use It when I use POP3



 var result= BounceDetectorMail.Detect(message);//message type MimeMessage
if (result.IsBounce)

em.DelivaryFailure = true;



so my problem I didn't find way to detect if my retrieved message is bounced or not when I use pop3 in retrieving










share|improve this question




























    1















    I fetched emails from servers by using IMAP or POP3 and entered the fetched emails to database but I noticed there are a lot of bounced emails entered to the system so I searched a lot on google to check fetched email and if it's bounced email I'll not enter it to the system and I found library BounceDetectResult to detect if email is bounced or not but this library working only with message type MimeMessage so It's useful when I use IMAP but it's not work with message type OpenPop.Mime.Message so I can't use It when I use POP3



     var result= BounceDetectorMail.Detect(message);//message type MimeMessage
    if (result.IsBounce)

    em.DelivaryFailure = true;



    so my problem I didn't find way to detect if my retrieved message is bounced or not when I use pop3 in retrieving










    share|improve this question


























      1












      1








      1








      I fetched emails from servers by using IMAP or POP3 and entered the fetched emails to database but I noticed there are a lot of bounced emails entered to the system so I searched a lot on google to check fetched email and if it's bounced email I'll not enter it to the system and I found library BounceDetectResult to detect if email is bounced or not but this library working only with message type MimeMessage so It's useful when I use IMAP but it's not work with message type OpenPop.Mime.Message so I can't use It when I use POP3



       var result= BounceDetectorMail.Detect(message);//message type MimeMessage
      if (result.IsBounce)

      em.DelivaryFailure = true;



      so my problem I didn't find way to detect if my retrieved message is bounced or not when I use pop3 in retrieving










      share|improve this question
















      I fetched emails from servers by using IMAP or POP3 and entered the fetched emails to database but I noticed there are a lot of bounced emails entered to the system so I searched a lot on google to check fetched email and if it's bounced email I'll not enter it to the system and I found library BounceDetectResult to detect if email is bounced or not but this library working only with message type MimeMessage so It's useful when I use IMAP but it's not work with message type OpenPop.Mime.Message so I can't use It when I use POP3



       var result= BounceDetectorMail.Detect(message);//message type MimeMessage
      if (result.IsBounce)

      em.DelivaryFailure = true;



      so my problem I didn't find way to detect if my retrieved message is bounced or not when I use pop3 in retrieving







      c# imap pop3






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 15 '18 at 17:26









      jstedfast

      18.7k15177




      18.7k15177










      asked Nov 13 '18 at 12:16









      sabreen sabersabreen saber

      267




      267






















          2 Answers
          2






          active

          oldest

          votes


















          0














          It looks like the MailBounceDetector library that you mentioned uses my MimeKit library to detect if a message is a bounced message or not.



          The good news is that you can use that library because I also have a library that does POP3 called MailKit, so you can use that instead of OpenPOP.NET.






          share|improve this answer






























            0














            For any who may need, from Bounce inspector software library, supports both POP3 and IMAP:



            // POP3 server information.
            const string serverName = "myserver";
            const string user = "name@domain.com";
            const string password = "mytestpassword";
            const int port = 995;
            const SecurityMode securityMode = SecurityMode.Implicit;
            // Create a new instance of the Pop3Client class.
            Pop3Client client = new Pop3Client();
            Console.WriteLine("Connecting Pop3 server: 0:1...", serverName, port);
            // Connect to the server.
            client.Connect(serverName, port, securityMode);
            // Login to the server.
            Console.WriteLine("Logging in as 0...", user);
            client.Authenticate(user, password);
            // Initialize BounceInspector.
            BounceInspector inspector = new BounceInspector();
            inspector.AllowInboxDelete = false; // true if you want BounceInspector automatically delete all hard bounces.
            // Register processed event handler.
            inspector.Processed += inspector_Processed;
            // Download messages from Pop3 Inbox to 'c:test' and process them.
            BounceResultCollection result = inspector.ProcessMessages(client, "c:\test");
            // Display processed emails.
            foreach (BounceResult r in result)

            // If this message was identified as a bounced email message.
            if (r.Identified)

            // Print out the result
            Console.Write("FileName: 0nSubject: 1nAddress: 2nBounce Category: 3nBounce Type: 4nDeleted: 5nDSN Action: 6nDSN Diagnostic Code: 7nn",
            System.IO.Path.GetFileName(r.FilePath),
            r.MailMessage.Subject,
            r.Addresses[0],
            r.BounceCategory.Name,
            r.BounceType.Name,
            r.FileDeleted,
            r.Dsn.Action,
            r.Dsn.DiagnosticCode);


            Console.WriteLine("0 bounced message found", result.BounceCount);
            // Disconnect.
            Console.WriteLine("Disconnecting...");
            client.Disconnect();





            share|improve this answer























            • Thanks for reply , but this library is not free

              – sabreen saber
              Nov 13 '18 at 13:01











            • You can use the free trial and see if it fits you, then search for alternatives of the sort if you really want to :)

              – Barr J
              Nov 13 '18 at 13:03











            • yes I see this library will achieve my requirements but I already searched about other free libraries but i didn't find any thing

              – sabreen saber
              Nov 13 '18 at 13:11










            Your Answer






            StackExchange.ifUsing("editor", function ()
            StackExchange.using("externalEditor", function ()
            StackExchange.using("snippets", function ()
            StackExchange.snippets.init();
            );
            );
            , "code-snippets");

            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "1"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53280820%2fhow-can-i-detect-if-my-fetched-email-is-bounced-or-not%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            It looks like the MailBounceDetector library that you mentioned uses my MimeKit library to detect if a message is a bounced message or not.



            The good news is that you can use that library because I also have a library that does POP3 called MailKit, so you can use that instead of OpenPOP.NET.






            share|improve this answer



























              0














              It looks like the MailBounceDetector library that you mentioned uses my MimeKit library to detect if a message is a bounced message or not.



              The good news is that you can use that library because I also have a library that does POP3 called MailKit, so you can use that instead of OpenPOP.NET.






              share|improve this answer

























                0












                0








                0







                It looks like the MailBounceDetector library that you mentioned uses my MimeKit library to detect if a message is a bounced message or not.



                The good news is that you can use that library because I also have a library that does POP3 called MailKit, so you can use that instead of OpenPOP.NET.






                share|improve this answer













                It looks like the MailBounceDetector library that you mentioned uses my MimeKit library to detect if a message is a bounced message or not.



                The good news is that you can use that library because I also have a library that does POP3 called MailKit, so you can use that instead of OpenPOP.NET.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 13 '18 at 14:04









                jstedfastjstedfast

                18.7k15177




                18.7k15177























                    0














                    For any who may need, from Bounce inspector software library, supports both POP3 and IMAP:



                    // POP3 server information.
                    const string serverName = "myserver";
                    const string user = "name@domain.com";
                    const string password = "mytestpassword";
                    const int port = 995;
                    const SecurityMode securityMode = SecurityMode.Implicit;
                    // Create a new instance of the Pop3Client class.
                    Pop3Client client = new Pop3Client();
                    Console.WriteLine("Connecting Pop3 server: 0:1...", serverName, port);
                    // Connect to the server.
                    client.Connect(serverName, port, securityMode);
                    // Login to the server.
                    Console.WriteLine("Logging in as 0...", user);
                    client.Authenticate(user, password);
                    // Initialize BounceInspector.
                    BounceInspector inspector = new BounceInspector();
                    inspector.AllowInboxDelete = false; // true if you want BounceInspector automatically delete all hard bounces.
                    // Register processed event handler.
                    inspector.Processed += inspector_Processed;
                    // Download messages from Pop3 Inbox to 'c:test' and process them.
                    BounceResultCollection result = inspector.ProcessMessages(client, "c:\test");
                    // Display processed emails.
                    foreach (BounceResult r in result)

                    // If this message was identified as a bounced email message.
                    if (r.Identified)

                    // Print out the result
                    Console.Write("FileName: 0nSubject: 1nAddress: 2nBounce Category: 3nBounce Type: 4nDeleted: 5nDSN Action: 6nDSN Diagnostic Code: 7nn",
                    System.IO.Path.GetFileName(r.FilePath),
                    r.MailMessage.Subject,
                    r.Addresses[0],
                    r.BounceCategory.Name,
                    r.BounceType.Name,
                    r.FileDeleted,
                    r.Dsn.Action,
                    r.Dsn.DiagnosticCode);


                    Console.WriteLine("0 bounced message found", result.BounceCount);
                    // Disconnect.
                    Console.WriteLine("Disconnecting...");
                    client.Disconnect();





                    share|improve this answer























                    • Thanks for reply , but this library is not free

                      – sabreen saber
                      Nov 13 '18 at 13:01











                    • You can use the free trial and see if it fits you, then search for alternatives of the sort if you really want to :)

                      – Barr J
                      Nov 13 '18 at 13:03











                    • yes I see this library will achieve my requirements but I already searched about other free libraries but i didn't find any thing

                      – sabreen saber
                      Nov 13 '18 at 13:11















                    0














                    For any who may need, from Bounce inspector software library, supports both POP3 and IMAP:



                    // POP3 server information.
                    const string serverName = "myserver";
                    const string user = "name@domain.com";
                    const string password = "mytestpassword";
                    const int port = 995;
                    const SecurityMode securityMode = SecurityMode.Implicit;
                    // Create a new instance of the Pop3Client class.
                    Pop3Client client = new Pop3Client();
                    Console.WriteLine("Connecting Pop3 server: 0:1...", serverName, port);
                    // Connect to the server.
                    client.Connect(serverName, port, securityMode);
                    // Login to the server.
                    Console.WriteLine("Logging in as 0...", user);
                    client.Authenticate(user, password);
                    // Initialize BounceInspector.
                    BounceInspector inspector = new BounceInspector();
                    inspector.AllowInboxDelete = false; // true if you want BounceInspector automatically delete all hard bounces.
                    // Register processed event handler.
                    inspector.Processed += inspector_Processed;
                    // Download messages from Pop3 Inbox to 'c:test' and process them.
                    BounceResultCollection result = inspector.ProcessMessages(client, "c:\test");
                    // Display processed emails.
                    foreach (BounceResult r in result)

                    // If this message was identified as a bounced email message.
                    if (r.Identified)

                    // Print out the result
                    Console.Write("FileName: 0nSubject: 1nAddress: 2nBounce Category: 3nBounce Type: 4nDeleted: 5nDSN Action: 6nDSN Diagnostic Code: 7nn",
                    System.IO.Path.GetFileName(r.FilePath),
                    r.MailMessage.Subject,
                    r.Addresses[0],
                    r.BounceCategory.Name,
                    r.BounceType.Name,
                    r.FileDeleted,
                    r.Dsn.Action,
                    r.Dsn.DiagnosticCode);


                    Console.WriteLine("0 bounced message found", result.BounceCount);
                    // Disconnect.
                    Console.WriteLine("Disconnecting...");
                    client.Disconnect();





                    share|improve this answer























                    • Thanks for reply , but this library is not free

                      – sabreen saber
                      Nov 13 '18 at 13:01











                    • You can use the free trial and see if it fits you, then search for alternatives of the sort if you really want to :)

                      – Barr J
                      Nov 13 '18 at 13:03











                    • yes I see this library will achieve my requirements but I already searched about other free libraries but i didn't find any thing

                      – sabreen saber
                      Nov 13 '18 at 13:11













                    0












                    0








                    0







                    For any who may need, from Bounce inspector software library, supports both POP3 and IMAP:



                    // POP3 server information.
                    const string serverName = "myserver";
                    const string user = "name@domain.com";
                    const string password = "mytestpassword";
                    const int port = 995;
                    const SecurityMode securityMode = SecurityMode.Implicit;
                    // Create a new instance of the Pop3Client class.
                    Pop3Client client = new Pop3Client();
                    Console.WriteLine("Connecting Pop3 server: 0:1...", serverName, port);
                    // Connect to the server.
                    client.Connect(serverName, port, securityMode);
                    // Login to the server.
                    Console.WriteLine("Logging in as 0...", user);
                    client.Authenticate(user, password);
                    // Initialize BounceInspector.
                    BounceInspector inspector = new BounceInspector();
                    inspector.AllowInboxDelete = false; // true if you want BounceInspector automatically delete all hard bounces.
                    // Register processed event handler.
                    inspector.Processed += inspector_Processed;
                    // Download messages from Pop3 Inbox to 'c:test' and process them.
                    BounceResultCollection result = inspector.ProcessMessages(client, "c:\test");
                    // Display processed emails.
                    foreach (BounceResult r in result)

                    // If this message was identified as a bounced email message.
                    if (r.Identified)

                    // Print out the result
                    Console.Write("FileName: 0nSubject: 1nAddress: 2nBounce Category: 3nBounce Type: 4nDeleted: 5nDSN Action: 6nDSN Diagnostic Code: 7nn",
                    System.IO.Path.GetFileName(r.FilePath),
                    r.MailMessage.Subject,
                    r.Addresses[0],
                    r.BounceCategory.Name,
                    r.BounceType.Name,
                    r.FileDeleted,
                    r.Dsn.Action,
                    r.Dsn.DiagnosticCode);


                    Console.WriteLine("0 bounced message found", result.BounceCount);
                    // Disconnect.
                    Console.WriteLine("Disconnecting...");
                    client.Disconnect();





                    share|improve this answer













                    For any who may need, from Bounce inspector software library, supports both POP3 and IMAP:



                    // POP3 server information.
                    const string serverName = "myserver";
                    const string user = "name@domain.com";
                    const string password = "mytestpassword";
                    const int port = 995;
                    const SecurityMode securityMode = SecurityMode.Implicit;
                    // Create a new instance of the Pop3Client class.
                    Pop3Client client = new Pop3Client();
                    Console.WriteLine("Connecting Pop3 server: 0:1...", serverName, port);
                    // Connect to the server.
                    client.Connect(serverName, port, securityMode);
                    // Login to the server.
                    Console.WriteLine("Logging in as 0...", user);
                    client.Authenticate(user, password);
                    // Initialize BounceInspector.
                    BounceInspector inspector = new BounceInspector();
                    inspector.AllowInboxDelete = false; // true if you want BounceInspector automatically delete all hard bounces.
                    // Register processed event handler.
                    inspector.Processed += inspector_Processed;
                    // Download messages from Pop3 Inbox to 'c:test' and process them.
                    BounceResultCollection result = inspector.ProcessMessages(client, "c:\test");
                    // Display processed emails.
                    foreach (BounceResult r in result)

                    // If this message was identified as a bounced email message.
                    if (r.Identified)

                    // Print out the result
                    Console.Write("FileName: 0nSubject: 1nAddress: 2nBounce Category: 3nBounce Type: 4nDeleted: 5nDSN Action: 6nDSN Diagnostic Code: 7nn",
                    System.IO.Path.GetFileName(r.FilePath),
                    r.MailMessage.Subject,
                    r.Addresses[0],
                    r.BounceCategory.Name,
                    r.BounceType.Name,
                    r.FileDeleted,
                    r.Dsn.Action,
                    r.Dsn.DiagnosticCode);


                    Console.WriteLine("0 bounced message found", result.BounceCount);
                    // Disconnect.
                    Console.WriteLine("Disconnecting...");
                    client.Disconnect();






                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Nov 13 '18 at 12:20









                    Barr JBarr J

                    6,06411031




                    6,06411031












                    • Thanks for reply , but this library is not free

                      – sabreen saber
                      Nov 13 '18 at 13:01











                    • You can use the free trial and see if it fits you, then search for alternatives of the sort if you really want to :)

                      – Barr J
                      Nov 13 '18 at 13:03











                    • yes I see this library will achieve my requirements but I already searched about other free libraries but i didn't find any thing

                      – sabreen saber
                      Nov 13 '18 at 13:11

















                    • Thanks for reply , but this library is not free

                      – sabreen saber
                      Nov 13 '18 at 13:01











                    • You can use the free trial and see if it fits you, then search for alternatives of the sort if you really want to :)

                      – Barr J
                      Nov 13 '18 at 13:03











                    • yes I see this library will achieve my requirements but I already searched about other free libraries but i didn't find any thing

                      – sabreen saber
                      Nov 13 '18 at 13:11
















                    Thanks for reply , but this library is not free

                    – sabreen saber
                    Nov 13 '18 at 13:01





                    Thanks for reply , but this library is not free

                    – sabreen saber
                    Nov 13 '18 at 13:01













                    You can use the free trial and see if it fits you, then search for alternatives of the sort if you really want to :)

                    – Barr J
                    Nov 13 '18 at 13:03





                    You can use the free trial and see if it fits you, then search for alternatives of the sort if you really want to :)

                    – Barr J
                    Nov 13 '18 at 13:03













                    yes I see this library will achieve my requirements but I already searched about other free libraries but i didn't find any thing

                    – sabreen saber
                    Nov 13 '18 at 13:11





                    yes I see this library will achieve my requirements but I already searched about other free libraries but i didn't find any thing

                    – sabreen saber
                    Nov 13 '18 at 13:11

















                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53280820%2fhow-can-i-detect-if-my-fetched-email-is-bounced-or-not%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    這個網誌中的熱門文章

                    How to read a connectionString WITH PROVIDER in .NET Core?

                    In R, how to develop a multiplot heatmap.2 figure showing key labels successfully

                    Museum of Modern and Contemporary Art of Trento and Rovereto