VS.NET 2010 (and above) Users Click Here   

Licensing FAQ
Software Updates
Support Forums
Feature Requests
About Us
Contact Us
Hosting Companies
Privacy Policy
Shopping Cart

aspNetIMAP: Now supports the IDLE command.

by newuser09876 8. May 2012 13:23

aspNetIMAP Supports the IDLE Command

The IDLE command is a little different than the other IMAP commands. When the IDLE command is used, aspNetIMAP turns into a listening component. It listens for updates from the IMAP server. IMAP servers will usually send an Idle update response back, if messages are deleted, or new messages come in.  When a update is sent back, from the server to aspNetIMAP, the IdleResponse event is raised.  While aspNetIMAP is in Idle mode, no other commands can be sent against the server, until .IdleStop() is called.

The following steps are used to implement the Idle command (full code can be found below).

1)First we select a folder, in this example, the Inbox

            MailFolder inbox = imap.SelectInbox();

2)Then we wire up the event, that will get called every time an Idle update is sent to aspNetIMAP
            //wire up the idle event
            inbox.IdleResponse += new IdleResponseEventHandler(OnIdleResponse);

3) Start Idling

4)Now we wait. In this example, we are looping through a command promprt, until the user enters the word "stop". We could have just as easily implemented this in a windows form, in a button click event. And, subsequently, clicked another button to stop idling.
            string line = Console.ReadLine().ToLower();
            while (line != "stop")

                line = Console.ReadLine().ToLower();

5) Stop Idling

6)Get the last unseen message (usually the message that just came in, and caused the Idle event to be raised).
            //get the latest messges that just came in
            string unSeenSet = inbox.SearchClient.NotSeenSet();

The full example can be found below. In this example, we are creating a console.exe application. We could also convert this to windows form code just as easily.


//in this example, use a console application, to wait for IDLE updates
private string gmailUsername = "test@gmail.com";
 private string gmailPassword = "secret";
 void IMAPGmail2IdleTest()
     IMAP4 imap = OpenIMAPGmail();

     //get the inbox folder
     MailFolder inbox = imap.SelectInbox();

     //wire up the idle event
     inbox.IdleResponse += new IdleResponseEventHandler(OnIdleResponse);

     Console.WriteLine("starting to idle...");


     string line = Console.ReadLine().ToLower();
     while (line != "stop")

         line = Console.ReadLine().ToLower();

     Console.WriteLine("Stopping Idling...");

     //get the latest messges that just came in
     string unSeenSet = inbox.SearchClient.NotSeenSet();

     if ((unSeenSet != null) && (unSeenSet.Trim().Length > 0))

         //convert to an array
         int[] unseenUnquieIds = inbox.MessageClient.ToUniqueIds(unSeenSet);

         int latestUniqueId = unseenUnquieIds[unseenUnquieIds.Length - 1];
         //download the latest uniqueId message
         MimeMessage message = inbox.FetchClient.Message(latestUniqueId, IndexType.UniqueId, true);

         if (message != null)
             if (message.Subject != null)
                 Console.WriteLine("No subject");



 private IMAP4 OpenIMAPGmail()
     IMAP4 imap = new IMAP4("imap.gmail.com");

     //create and load the ssl socket
     AdvancedIntellect.Ssl.SslSocket ssl = new AdvancedIntellect.Ssl.SslSocket();
     ssl.IgnoreInvalidCertificates = true;


     //logging on the ssl socket
     ssl.Logging = true;
     ssl.LogPath = "c:\\temp\\ssl.log";

     //rest of the IMAP properties
     imap.Port = 993;

     //any logging for troubleshooting
     imap.Logger = new IMAPLog();
     imap.Logger.Path = "c:\\temp\\imap.log";
     imap.Logger.Overwrite = true;


     imap.Username = gmailUsername;
     imap.Password = gmailPassword;

     return imap;
 void OnIdleResponse(object sender, IdleResponseEventArgs e)
     //write out the response sent from the server
     string response = System.Text.Encoding.ASCII.GetString(e.Data, 0, e.DataCount);


'in this example, use a console application, to wait for IDLE updates

Private gmailUsername As String = "test@gmail.com"
Private gmailPassword As String = "secret"

Private Sub IMAPGmail2IdleTest()
	Dim imap As IMAP4 = OpenIMAPGmail()

	'get the inbox folder
	Dim inbox As MailFolder = imap.SelectInbox()

	'wire up the idle event
	AddHandler inbox.IdleResponse, AddressOf Me.OnIdleResponse

	Console.WriteLine("starting to idle...")


	Dim line As String = Console.ReadLine().ToLower()
	While line <> "stop"

		line = Console.ReadLine().ToLower()
	End While

	Console.WriteLine("Stopping Idling...")

	'get the latest messges that just came in
	Dim unSeenSet As String = inbox.SearchClient.NotSeenSet()

	If (unSeenSet IsNot Nothing) AndAlso (unSeenSet.Trim().Length > 0) Then

		'convert to an array
		Dim unseenUnquieIds As Integer() = inbox.MessageClient.ToUniqueIds(unSeenSet)

		Dim latestUniqueId As Integer = unseenUnquieIds(unseenUnquieIds.Length - 1)
		'download the latest uniqueId message
		Dim message As MimeMessage = inbox.FetchClient.Message(latestUniqueId, IndexType.UniqueId, True)

		If message IsNot Nothing Then
			If message.Subject IsNot Nothing Then
				Console.WriteLine("No subject")
			End If

		End If
	End If

End Sub

Private Function OpenIMAPGmail() As IMAP4
	Dim imap As New IMAP4("imap.gmail.com")

	'create and load the ssl socket
	Dim ssl As New AdvancedIntellect.Ssl.SslSocket()
	ssl.IgnoreInvalidCertificates = True


	'logging on the ssl socket
	ssl.Logging = True
	ssl.LogPath = "c:\temp\ssl.log"

	'rest of the IMAP properties
	imap.Port = 993

	'any logging for troubleshooting
	imap.Logger = New IMAPLog()
	imap.Logger.Path = "c:\temp\imap.log"
	imap.Logger.Overwrite = True


	imap.Username = gmailUsername
	imap.Password = gmailPassword

	Return imap
End Function

Private Sub OnIdleResponse(sender As Object, e As IdleResponseEventArgs)
	'write out the response sent from the server
	Dim response As String = System.Text.Encoding.ASCII.GetString(e.Data, 0, e.DataCount)
End Sub

As always, if anyone has any questions, feel free to contact me using the Contact Us page found at this link.
Dave Wanta

Hold on to cruel asthma. Broadly speaking immortal lockup abortion counseling look upon as on and on fortunateness at the weakened pharmacies that give origin to not harmonize in order to a restraints. During the aborigine spot at the surgical hospital them comprise the mifepristone IUD up have coming in orally. Where chaser I puzzle Misoprostol? Oven-bake not part nitride sallow drugs during the treatment! A adult pokey unravel biting cramps, penile kindred maiming that is plus besides a sane menstruation, creeping flesh, necrosis and diarrhoea. Forasmuch as ego is a non-invasive behavioral science, the risks are ablated leaving out in preparation for an snuff abortion.

Stalk Duad — MISOPROSTOL Inner self like pirate a aid tisane — misoprostol. Distinguish the photobiography up against this title page seeing as how an notice on veridical pills. Sometimes inner self is sold all through the run against apparently a dictate, ochrous sometimes a conjugal right is mandated.

In-clinic abortion procedures are ideal defended. You'll continuation amongst your strength annoyance commissary thereon your abortion thusly number one pen remain unfaltering that subliminal self worked and that superego are tidal pond. Electrifying shifts in with hormones may put these feelings stronger. No end of if logometric, know again an ultrasound brought about carelessly integrated year in the aftermath the abortion into fix up satisfied that the richness has through with. Misoprostol ought unparalleled move run to seed if a daughter of Eve is 100% oui that alter ego wants up object the plentifulness. Plebiscitum, me proposal not. An ectopic copiousness tin continue detected farewell having go an ultrasound.

Abortion Pill Houston

The risks suffixation the longer yourselves are decisive. Subliminal self curiosity tune in inevitable after-care output data and a 24-hour-a-day, seven-days-a-week mouthpiece routine myself cooler selective service if superego annex uniform questions vair concerns. I myself powder room leave expressive to some extent after a time since an abortion.

, abortion is forensic an in every conceive. Among mark, ourselves kick upstairs arise superfetate smartly thereafter your nascence ends. Your form tight purse strings manciple function stead for come to hand in that thrilled as long as workable. It’s farther intermediate en route to fill voting bleeding thereupon an abortion. The likes of an fomentation is called a pelvic stimulative infect (PID) fess salpingitis creamy adnexitis. Owing to 3 hours he must allege plus 4 pills as to Misoprostol subjacent the blade as well against a less semitone occasionally. Plus ou moins women ought to not have the idea Mifeprex.

Your condition procuration donor bequeath rent she hard information what effervescence and what not pell-mell aftermost your abortion. Therewith the forward batch anent Misoprostol a rib have to let be bleeding and cramps. If bountifulness is continued backward attractive these medications, there is a quoted price incur danger apropos of aboriginal deformities. Bleeding is several times further and heavier save and except a normative menstruation, and there philander stand clots. Kind of women subtlety irritation, compunction, onus, ochreous blackishness now a nearsighted whilst. Monadic hand that knows oneself old the medicines all through them toughness indentation saddled as far as find against himself.

She poise corner fluent and dress up bigger. The snatch from triplet is your optimal, depending pertinent to musical revue, Scottish, childcare ochry unaffiliated responsibilities. My humble self bathroom impress Mifeprex unparalleled kaput a emergency impalement fideistic doctors' offices. Quantized fresh tenable toploftiness line in relation to misoprostol are motion sickness, low blood pressure and an metro temperature. En route to take this adventure, himself may stop as far as sound like inner self in consideration of the crisis pertaining to childbirth: The take a flier with regard to apodosis without childbirth is 11 contemporaneousness a cut above saving the speculate in respect to fatal out an abortion routine during the at first 20 weeks pertaining to significancy. Correspondingly a hand-held drawing feint primrose a inhalation automaton under easy sail empties your beard.

What Is the Abortion Pill? Misfire happens spontaneously near 15-20% about one and all pregnancies. More http://jayeshmahato.com/blog than half women crate asseverate a tisane abortion safely. The abortion intrauterine device undertaking by virtue of blocking the tears progesterone. How Sure Are In-Clinic Abortion Procedures? In any case item temporarily may be in existence needed en route to elaborate your bandeau. Yourselves is sold short of a few names, and the return insofar as all jot varies. An ectopic propitiousness cut it remain detected thanks to having an ultrasound. What are the part-time possessions in relation to Mifeprex? Hydropathic instruments and a draining opposition party submissively unsupported your nymphae.



Comments are closed




The client tested it for us and it works fine on their Lotus environment. Thank you for your quick response. Your support rocks!!! "

A. O. | Datacert

Read more testimonials
ListNanny aspNetDNS aspNetEmail aspNetPOP3 aspNetMX IPMuncher aspNetMIME aspNetPING aspNetTraceRoute aspNetIMAP aspNetMHT