Check Every 5s, Retrieve, then Delete
Previous Topic  Next Topic 



This example demonstrates how to check an email account on a POP3 server every 5 seconds for new messages, retrieve any messages, then delete them from the POP3 server.


** WARNING ** This example will delete all emails for the specified user account on the specified POP3 email server. You should use a test account for this example to ensure that critical data is not accidentally deleted. 


Why Use this Feature?


This feature is useful for monitoring a POP3 email account for new email messages that you wish to retrieve on a regular basis. One might use this feature to retrieve a message that contains an attachment. 


For example, if a company has a number of satelite offices that send daily reports to a single email address for collation, one would use this feature to monitor that email account and automatically save the attachment.


Additional Prerequisites


The user account you specify should have at least one email message on the POP server in order for this example to work. An email can be sent to the account you specify with a different example, click here.


Prepared Example Files



The archive contains one file:



Batch File Contents


This is the content of the batch file:


NetMailBot -receive -popreceive -popwatch -popwait 5000 -popdelete -popserver -popuser -poppassword test






  1. Unzip the file. This will produce a directory called "FiveSecCheckDelete". Open this directory.
  2. Open Notepad and edit the batch file "FiveSecCheckDelete.bat". Change the values of the following parameters:


NOTE: The parameter -receive is required whenever using the POP3 parameters.


  1. Invoke the batch file by double-clicking the icon or straight from the command line.
  2. An email message from your POP3 mail server should be downloaded and the message parts should be saved to your hard drive in a folder named "pop" under your System Temporary Directory.
  3. After the email message is downloaded, it will be deleted from the POP3 mail server.