Exchange: Save Sent Mail in a Different Mailbox: imapsync

Uncategorized Add comments

My company uses Exchange — and it’s not bad, considering that it brings in the SyncML (I think) technology that Gmail also has — if only it had the rest of what Gmail has, but I can understand if we’re not moving to avoid thrashing about.

The problem is that when I send mail, I wand to receive a copy, I don’t want a bcc:, but Entourage (the only Exchange client for a laptop that doesn’t die) only allows saving a copy in the “Sent Items” folder. I know, it’s simple enough to copy stuff around, but hey, I can get a cronjob to do that…

  1. create a file (with restrictive permissions) containing only the password:
    — /home/scott/imapsync-pw-exchange —
    tiger

    In my example, user “scott” has password “tiger”. Bonus points if know where that user/pass comes from 🙂

  2. drop a cron.hourly consisting of:
    — /etc/cron.hourly/scott-exchange-sync —

    imapsync 
      --host1 exchange.example.com  --port1 993 --authmech1 PLAIN 
      --host2 exchange.example.com  --port2 993 --authmech2 PLAIN 
      --user1 scott --ssl1 --passfile1 /home/scott/imapsync-pw-exchange 
      --user2 scott --ssl2 --passfile2 /home/scott/imapsync-pw-exchange 
      --folder 'Sent Items' --regextrans2 's/Sent Items/INBOX/g' 

    (or, better, crontab -e yourself a cron job that fires on 5-minute accuracy)

  3. profit!!!1!one!! … oh wait… uh… sit and relax.

The trick here is that we’re using imapsync to connect to our own server twice, as two clients, to sync the “Sent Items” folder. Yes, those two sections of parameters are exactly the same (except for s/1/2/ — and use the same password file) on purpose. The “regextrans2” tells it that we want to “translate” one folder to another (that may exist). Note that we’re deleting and expunging the moved files to avoid dupes.

Leave a Reply

WP Theme & Icons by N.Design Studio
Entries RSS Comments RSS Log in