You are hereFetchExc and Procmail
FetchExc and Procmail
Click here for reference article.
I have a customer that gives me access to their email servers via Citrix and Outlook Web Access (OWA) (http://mail.domain.com/exchange). They expect me to check email all day so I found myself checking email 100 times a day via Citrix and it was becoming annoying. I have a blackberry and I wanted to use it to receive emails as they arrive. I found myself logging on to the Outlook Mobile Access website (http://mail.domain.com/oma) but that was very slow and buggy. I also tried forwarding all the email using a rule but that had the bad effect of forwarding EVERY email to my blackberry; I get about 200 emails from monitoring applications a day that get routed to folders using Outlook rules. Also, forwarding emails outside of the organization is against company policy and any Exchange administrator could see my forwarding rule.
I finally found my answer reading Paul Nicholls' blog where he bypassed his schools anti-forwarding policy.
I already knew about fetchExc but was lost with the documentation.
Based on his article and my trial and error, my fetchExc.properties looks as follows:
ExchangeServer=mail.domain.com
ExchangePath=exchange
MailServer=localhost
DestinationAddress=/usr/bin/procmail
Username=user1
Password=password1
Domain=DOMAIN
Delete=false
All=false
Secure=true
ProcMail=true
FBApath=/exchweb/bin/auth/owaauth.dll
NoEightBitMime=false
My ~/.procmailrc file looks as follows:
:0
! user1@vzw.blackberry.net
I tested my work by executing:
/usr/bin/java -jar fetchExc.jar $* >> fetchExc.log 2>> fetchExc.err
In fetchExc.log I found an entry similar to this:
Starting fetchExc v2.0 Fri, 19 Jun 2009 07:38:01
1 message for user1 at mail.domain.com
Message 1 sent OK
I had a lot of issues with PATH and trying to get the script suggested by Paul to work in cron, so I decided to use the following:
*/1 * * * * /usr/bin/java -jar /home/user1/fetchExc-2.0/fetchExc.jar -p /home/user1/fetchExc-2.0/fetchExc.properties >> /home/user1/fetchExc-2.0/fetchExc.log 2>> /home/user1/fetchExc-2.0/fetchExc.err
Every minute of the day, my server checks for new messages. Only messages that stay in the Inbox are forwarded.
The logs started getting big fast, so I had to direct logrotate to clean them for me. I created the file /etc/logrotate.d/fetchExc with the following information:
/home/user1/fetchExc-2.0/fetchExc.err {
rotate 3
daily
compress
missingok
notifempty
}/home/user1/fetchExc-2.0/fetchExc.log {
rotate 3
daily
compress
missingok
notifempty
}
Now I can check on whether fetchExc was doing its thing for the last 3 days. Happy hacking.





Post new comment