Search The ForumSearch   RegisterRegister  LoginLogin

MailBee.NET Objects

 AfterLogic Forum : MailBee.NET Objects
Subject Topic: Strange Issue About Downloading Message Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
tahirahmed
Newbie
Newbie


Joined: 04 April 2012
Location: United States
Online Status: Offline
Posts: 4
Posted: 04 April 2012 at 11:03pm | IP Logged Quote tahirahmed

Hello,

I am experimenting with examples given in your docs but I am facing a strange problem.

I am trying to download a simple message from a test gmail account. Here is my code.

        protected void Page_Load(object sender, EventArgs e)
        {
            Pop3 pop = new Pop3();
            try
            {
               pop.Connect("pop.gmail.com");
               pop.InboxPreloadOptions = Pop3InboxPreloadOptions.Uidl;
               pop.Login("test-gmail-address", "test-password");
               Response.Write("Successfully logged in.");
               MailMessage msg = pop.DownloadEntireMessage(pop.InboxMessageCount);
               //Response.Write(pop.DownloadEntireMessage(1));
               Response.Write(msg.DateReceived);
               Response.Write(msg.BodyPlainText);
            }
            catch (MailBeePop3LoginNegativeResponseException)
            {
               Response.Write("POP3 server replied with a negative response at login.");
            }
            try
            {
               pop.Disconnect();
               Response.Write("Disconnected successfully.");
            }

            catch
            {
               Response.Write("Disconnection failed.");
            }
        }

It works fine but only one time, after downloading and displaying a message it won't download it again? like it marks it as read if I try to run the same code again it gives me index out of bound exception which means pop.InboxMessageCount is returning 0. Any help would be appreciated.

Thanks.
Back to Top View tahirahmed's Profile Search for other posts by tahirahmed
 
Igor
AfterLogic Support
AfterLogic Support


Joined: 24 June 2008
Location: United States
Online Status: Offline
Posts: 6089
Posted: 04 April 2012 at 11:08pm | IP Logged Quote Igor

That's a known behavior aspect of GMail POP3 service. When they implemented POP3 support, they wanted to have a workaround for read/unread message status unavailable in POP3, and the approach they chose is to delete message from POP3 box after downloading it. Later on, they added a configuration option for this behavior, you can find it in GMail account settings, under "Forwarding and POP/IMAP" section. The option is "When messages are accessed with POP", setting it to "Keep GMail's copy in the Inbox" should do the trick.

--
Regards,
Igor, AfterLogic Support
Back to Top View Igor's Profile Search for other posts by Igor
 
tahirahmed
Newbie
Newbie


Joined: 04 April 2012
Location: United States
Online Status: Offline
Posts: 4
Posted: 04 April 2012 at 11:28pm | IP Logged Quote tahirahmed

Thank you Igor,

As per your advice I checked the settings of my account and it was already on Keep Gmail's Copy in Inbox. To make sure I changed it and then changed it back to Keep Gmail's Copy in Inbox then saved it but it's still giving me same error

One more question does hotmail pop also have similar behavior ?

Thanks again.
Back to Top View tahirahmed's Profile Search for other posts by tahirahmed
 
Igor
AfterLogic Support
AfterLogic Support


Joined: 24 June 2008
Location: United States
Online Status: Offline
Posts: 6089
Posted: 04 April 2012 at 11:30pm | IP Logged Quote Igor

I believe Hotmail offers quite standard POP3 implementation, you shouldn't encounter issues of such kind there.

--
Regards,
Igor, AfterLogic Support
Back to Top View Igor's Profile Search for other posts by Igor
 
Igor
AfterLogic Support
AfterLogic Support


Joined: 24 June 2008
Location: United States
Online Status: Offline
Posts: 6089
Posted: 04 April 2012 at 11:31pm | IP Logged Quote Igor

With regard to GMail, I would suggest using IMAP with it rather than POP.

--
Regards,
Igor, AfterLogic Support
Back to Top View Igor's Profile Search for other posts by Igor
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump

Powered by Web Wiz Forums version 7.9
Copyright ©2001-2004 Web Wiz Guide