Author |
|
tahirahmed Newbie
Joined: 04 April 2012 Location: United States
Online Status: Offline Posts: 4
|
Posted: 04 April 2012 at 11:03pm | IP Logged
|
|
|
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 |
|
|
Igor AfterLogic Support
Joined: 24 June 2008 Location: United States
Online Status: Offline Posts: 6104
|
Posted: 04 April 2012 at 11:08pm | IP Logged
|
|
|
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 |
|
|
tahirahmed Newbie
Joined: 04 April 2012 Location: United States
Online Status: Offline Posts: 4
|
Posted: 04 April 2012 at 11:28pm | IP Logged
|
|
|
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 |
|
|
Igor AfterLogic Support
Joined: 24 June 2008 Location: United States
Online Status: Offline Posts: 6104
|
Posted: 04 April 2012 at 11:30pm | IP Logged
|
|
|
I believe Hotmail offers quite standard POP3 implementation, you shouldn't encounter issues of such kind there.
--
Regards,
Igor, AfterLogic Support
|
Back to Top |
|
|
Igor AfterLogic Support
Joined: 24 June 2008 Location: United States
Online Status: Offline Posts: 6104
|
Posted: 04 April 2012 at 11:31pm | IP Logged
|
|
|
With regard to GMail, I would suggest using IMAP with it rather than POP.
--
Regards,
Igor, AfterLogic Support
|
Back to Top |
|
|