Search The ForumSearch   RegisterRegister  LoginLogin

MailBee.NET IMAP

 AfterLogic Forum : MailBee.NET IMAP
Subject Topic: new message notification Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
palanka
Newbie
Newbie


Joined: 19 January 2009
Location: United States
Online Status: Offline
Posts: 7
Posted: 19 January 2009 at 7:57am | IP Logged Quote palanka

how do i capture notification that a new message has arrived?

i am running against a gmail account if that makes any difference.

my small application must monitor a gmail account 24x7 and pick up any new message as soon as it arrives.   i have the imap demo2 application running successfully against a gmail account already (many thanks for the demo!)

any suggestions?

thanks,
tim
Back to Top View palanka's Profile Search for other posts by palanka
 
Igor
AfterLogic Support
AfterLogic Support


Joined: 24 June 2008
Location: United States
Online Status: Offline
Posts: 6038
Posted: 19 January 2009 at 8:45am | IP Logged Quote Igor

This can be achieved using IDLE mode provided by appropriate mail server extension.

You can download a sample application here. It enters IDLE mode, and when there's a new message on IMAP server, the application stops idling, downloads the message and restarts the idling process.

The package includes complete source code and the executable file. You can use this code for developing your application.

Regards,
Igor
Back to Top View Igor's Profile Search for other posts by Igor
 
palanka
Newbie
Newbie


Joined: 19 January 2009
Location: United States
Online Status: Offline
Posts: 7
Posted: 20 January 2009 at 7:23am | IP Logged Quote palanka

Thanks Igor, your examples have been extremely helpful!

Tim
Back to Top View palanka's Profile Search for other posts by palanka
 
palanka
Newbie
Newbie


Joined: 19 January 2009
Location: United States
Online Status: Offline
Posts: 7
Posted: 20 January 2009 at 7:45am | IP Logged Quote palanka

Hi Igor, I seem to have an issue with gmail on the example, see log file. My firewall is off. I got the same result for port 993 and the default port.

any ideas?


[09:33:22.30] [INFO] Assembly version: 4.0.2.105.
[09:33:22.28] [INFO] Will resolve host "imap.gmail.com".
[09:33:22.39] [INFO] Host "imap.gmail.com" resolved to IP address(es) 209.85.133.111, 209.85.133.109.
[09:33:22.39] [INFO] Will connect to host "imap.gmail.com" on port 993.
[09:33:22.52] [INFO] Error: SocketException occurred. InnerException message follows: An attempt was made to access a socket in a way forbidden by its access permissions 209.85.133.111:993
Back to Top View palanka's Profile Search for other posts by palanka
 
Andrew
AfterLogic Support
AfterLogic Support


Joined: 28 April 2006
Location: United States
Online Status: Offline
Posts: 1189
Posted: 21 January 2009 at 4:19am | IP Logged Quote Andrew

The sample we provided you with doesn't have SSL support, but Gmail requires SSL connections. So, you should just enable SSL.

If enabling SSL (it's important to use SslStartupMode.OnConnect mode) doesn't help, please capture new log file and provide us for examination.

Best regards,
Andrew
Back to Top View Andrew's Profile Search for other posts by Andrew
 
palanka
Newbie
Newbie


Joined: 19 January 2009
Location: United States
Online Status: Offline
Posts: 7
Posted: 21 January 2009 at 9:21am | IP Logged Quote palanka

OK i got sslstartupmode set, but still same error:

imp = new Imap();
imp.SslMode = SslStartupMode.OnConnect;

imp.Log.Filename = @"log.txt";
imp.Log.Enabled = true;
imp.Log.Clear();

imp.Connect(textBoxServer.Text, 993);

log file:

[11:15:44.22] [INFO] Assembly version: 4.0.2.105.
[11:15:44.19] [INFO] Will resolve host "imap.gmail.com".
[11:15:45.42] [INFO] Host "imap.gmail.com" resolved to IP address(es) 209.85.133.109, 209.85.133.111.
[11:15:45.44] [INFO] Will connect to host "imap.gmail.com" on port 993.
[11:15:46.80] [INFO] Error: SocketException occurred. InnerException message follows: An attempt was made to access a socket in a way forbidden by its access permissions 209.85.133.109:993


Thanks again for your help,
Tim
Back to Top View palanka's Profile Search for other posts by palanka
 
Igor
AfterLogic Support
AfterLogic Support


Joined: 24 June 2008
Location: United States
Online Status: Offline
Posts: 6038
Posted: 22 January 2009 at 2:53am | IP Logged Quote Igor

The code itself is fine, but it seems your system experiences concurrent connections limit. Please refer to this article, it contains detailed information on the issue and instructions how to overcome it.

Regards,
Igor
Back to Top View Igor's Profile Search for other posts by Igor
 
palanka
Newbie
Newbie


Joined: 19 January 2009
Location: United States
Online Status: Offline
Posts: 7
Posted: 22 January 2009 at 7:37am | IP Logged Quote palanka

Igor, i don't think my system is in the state described in the article, see results below.

Its interesting that your imapdemo2 solution connects to gmail perfectly. I studied the differences and the only thing that i see is that imapdemo2 connects using asynchronous BeginConnect/EndConnect and the idle demo using synchronous Connect. any possibility that is the issue?

tim

Proto Local Address          ; Foreign Address        State         & nbsp; PID
TCP    127.0.0.1:668   &n bsp;      127.0.0.1:49194  ;       ESTABLISHED     2932
TCP    127.0.0.1:27015         127.0.0.1:49160        ESTABLISHED     2860
TCP    127.0.0.1:49160         127.0.0.1:27015        ESTABLISHED     2340
TCP    127.0.0.1:49194         127.0.0.1:668         ;  ESTABLISHED     2252
TCP    127.0.0.1:58864         127.0.0.1:58865        ESTABLISHED     5320
TCP    127.0.0.1:58865         127.0.0.1:58864        ESTABLISHED     5320
TCP    127.0.0.1:58866         127.0.0.1:58867        ESTABLISHED     5320
TCP    127.0.0.1:58867         127.0.0.1:58866        ESTABLISHED     5320
TCP    192.168.0.117:59075  &n bsp; 74.201.74.24:12975     ES TABLISHED     2532
TCP    192.168.0.117:59174  &n bsp; 192.168.0.133:3389     ES TABLISHED     4664
TCP    192.168.0.117:59337  &n bsp; 72.246.98.91:80       ;  TIME_WAIT       0
Back to Top View palanka's Profile Search for other posts by palanka
 
palanka
Newbie
Newbie


Joined: 19 January 2009
Location: United States
Online Status: Offline
Posts: 7
Posted: 24 January 2009 at 3:59pm | IP Logged Quote palanka

I tried my own suggestion - using BeginConnect/EndConnect instead of just Connect - and it did not work.

Why does IMAPDemo2 connect successfully to imap.gmail.com, but the IDLE Sample program does not?

tim
Back to Top View palanka's Profile Search for other posts by palanka
 
Alex
AfterLogic Support
AfterLogic Support
Avatar

Joined: 19 November 2003
Online Status: Offline
Posts: 2206
Posted: 26 January 2009 at 8:14am | IP Logged Quote Alex

Try IMAP Demo 1, it also uses Connect instead of BeginConnect.

Regards,
Alex
Back to Top View Alex's Profile Search for other posts by Alex
 
palanka
Newbie
Newbie


Joined: 19 January 2009
Location: United States
Online Status: Offline
Posts: 7
Posted: 26 January 2009 at 8:48am | IP Logged Quote palanka

Thanks Alex, i tried that, but had the same outcome:

IMAP Demo1 does not connect
IMAP Demo2 does connect
IDLE Sample does not connect

My firewall is off. I assume all 3 programs operate correctly on your equipment.

have you any other suggestions?

thanks guys,
tim
Back to Top View palanka's Profile Search for other posts by palanka
 
Alex
AfterLogic Support
AfterLogic Support
Avatar

Joined: 19 November 2003
Online Status: Offline
Posts: 2206
Posted: 29 January 2009 at 6:51am | IP Logged Quote Alex

Weird. What happens if you do an opposite thing - modify IMAP Demo 2 and replace BeginConnect with Connect? Is the connection result the same?

Of course, login stage would not run in this case as the callback function won't be called but maybe the connection itself will complete successfully?

Regards,
Alex
Back to Top View Alex's Profile Search for other posts by Alex
 
JonGetty
Newbie
Newbie
Avatar

Joined: 08 October 2009
Location: United States
Online Status: Offline
Posts: 1
Posted: 08 October 2009 at 10:46am | IP Logged Quote JonGetty

Just Tried IMAP Demo 1 with Alex's example above and this time it worked well. Thanks for this useful thread.
Back to Top View JonGetty's Profile Search for other posts by JonGetty
 
ailaonzo
Newbie
Newbie
Avatar

Joined: 14 October 2009
Location: Philippines
Online Status: Offline
Posts: 2
Posted: 17 October 2009 at 9:11am | IP Logged Quote ailaonzo

thanks for this. this really helped me
Back to Top View ailaonzo's Profile Search for other posts by ailaonzo
 
jerryboone
Newbie
Newbie
Avatar

Joined: 22 October 2009
Location: Philippines
Online Status: Offline
Posts: 1
Posted: 27 October 2009 at 12:04am | IP Logged Quote jerryboone

i tried what alex said. it worked for me!
Back to Top View jerryboone's Profile Search for other posts by jerryboone
 
christineb1979
Newbie
Newbie
Avatar

Joined: 27 December 2010
Location: United States
Online Status: Offline
Posts: 2
Posted: 27 December 2010 at 8:08pm | IP Logged Quote christineb1979

Can anyone give instruction about this?
Back to Top View christineb1979's Profile Search for other posts by christineb1979 Visit christineb1979's Homepage
 
christineb1979
Newbie
Newbie
Avatar

Joined: 27 December 2010
Location: United States
Online Status: Offline
Posts: 2
Posted: 27 December 2010 at 8:09pm | IP Logged Quote christineb1979

Any help will much appreciated.
Back to Top View christineb1979's Profile Search for other posts by christineb1979 Visit christineb1979's Homepage
 
Igor
AfterLogic Support
AfterLogic Support


Joined: 24 June 2008
Location: United States
Online Status: Offline
Posts: 6038
Posted: 28 December 2010 at 12:38am | IP Logged Quote Igor

christineb1979: what exactly you need help with?

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


Joined: 10 October 2011
Location: Germany
Online Status: Offline
Posts: 1
Posted: 10 October 2011 at 4:14am | IP Logged Quote bookofradeluxe

Can anyone give instruction about this?
Back to Top View bookofradeluxe's Profile Search for other posts by bookofradeluxe Visit bookofradeluxe's Homepage
 
Igor
AfterLogic Support
AfterLogic Support


Joined: 24 June 2008
Location: United States
Online Status: Offline
Posts: 6038
Posted: 10 October 2011 at 4:15am | IP Logged Quote Igor

About what exactly, bookofradeluxe?

--
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