Project Description
This is a script based POP3 connector for Exchange.
It works with all Exchange having "Pickup folder"

I was searching for a free solution to connect some POP3 mailboxes to an Exchange server for long-long time, but found nothing free.
Some days ago I've read this article about Exchange's "Pickup folder": http://www.msexchange.org/articles_tutorials/exchange-server-2007/management-administration/exchange-pickup-folder.html
I've found it interesting, and started to test the functionality of this Pickup folder. I realized in the very beginning, that the new folder I've just created for this Pickup folder is not working at all. The problem was the NTFS acl of this folder. After I had "copied" the acl entries from the original Pickup folder, the Exchange started to use it.
I've found it is fine, and gives me an opportunity to create some scripts for automatization.
Then I only had to find some command-line POP3 client, so I've started to search for it. The net is full with it. I've chosen this one: Commandline POP3 client from this site: http://www.codeode.com/popclient.html.
This one has a simple clear text .xml configfile holding the informations regarding the connection details to the "source" POP3 server. If it is configured not to save the attachments separately, it saves the complete RFC822 message in a .txt file to the given folder.
This is just fine for transferring to the Pickup folder of the Exchange, only one thing is here to solve: how to specify the recipient address!
First I was thinking about modifying the "TO" field of the saved .txt file, but later I've changed my mind:
To modify the TO field first I have to search for it, and with this modification I lost the original content of this field, so the resulting mail will not contain the original "TO" data.
So my decision gone to the "BCC" field, as when the original mail received to the source POP3 mailbox, it surely lost this field. this mean I do not have to search for this field as it must not exists in the saved RFC822 .txt file. So the most simple thing is to insert a new line in the very beginning of the saved file with content: "BCC: <target mail address>".
I've tested it and found working just as expected.
Then I was thinking about some sign to the mails handled with this solution. The best thing could be to add a "Prefix" to the subject. And it is so simple as the line in the RFC822 containing the subject must exists and must exists only one line with this information. And it must starts with this: "Subject: ".
So I've modified my vbscript which copies the content from the .txt to the .eml adding that first "BCC: " line to search for the line starting with "Subject: " and replace it with "Subject: <Prefix>: ".
After the .txt file is copied to the .eml file, the original file should be renamed to for example .done by the script.
The last thing is to create an automation for remove the old .done files from the download folder.
And at the end I've created a .cmd file for calling these three step, so this way I'll have to schedule only one command per POP3 accounts.

Here are the results:
  • You have to create and configure a Pickup folder for the Exchange, or you can use the default one if it is acceptable.
  • You have to create a separate "download folder" for each POP3 account you want to connect. This folder has to have the following in it:
    • The popclient.exe extracted from popclient.zip,
    • The popclient.xml copied from the democonfig.xml from popclient.zip and filled out with the connection data.
    • A subfolder named mails. This folder will hold the downloaded mails.
    • The toExchange.vbs file with filled out parameters inside!
    • A subfolder named log. This folder will hold the logs for this connection (When using UNC as Exchange Pickup folder, then the scheduled job has to run under a domain account!)
  • You have to save connector.cmd anywhere to the server
  • And finally you have to create separate scheduled jobs starting this connector.cmd, and the start in must be the corresponding download folder. If no UNC used, then can be run under the local SYSTEM account, or any account which has enough rights to write to the download folder and to the Pickup folder.

Last edited Nov 6, 2012 at 4:29 PM by placa, version 8