views:

1237

answers:

1

I have a secondary Exchange mailbox configured on my iPhone using IMAP. This all appears to work fine except when a message is deleted on the phone, it still shows normally in Outlook. It does not seem to matter what I set the "remove deleted messages" setting to on the phone.

I understand this is due to a combination of the phone not expunging the deleted messages and Exchange showing deleted but not expunged messages in Outlook.

I'm looking for an automated solution to this that does not have a large delay between deleting the message on the phone and it disappearing in Outlook. The message should also show in the Deleted Items when deleted from the phone.


I've thought about creating a background process which connects to the mailbox via IMAP and sits in IDLE mode until there's a deleted message in the folder. It will then expunge the folder and return to IDLE mode. This wouldn't work with more than one folder (without multiple instances) but it would probably do the job.

Any recommendations on an easily scriptable tool or library that supports IMAP IDLE?

+1  A: 

Hi,

I can wholeheartedly recommend writing such a process with a simple Perl client using the Mail::IMAPClient module.

#!/usr/bin/perl -w
use strict;
use Mail::IMAPClient;

# returns an unconnected Mail::IMAPClient object:
my $imap = Mail::IMAPClient->new(  
                    Server => $host,
                    User    => $id,
                    Password=> $pass,
)       or die "Cannot connect to $host as $id: $@";
$imap->expunge();

This can then be run from crontab or some other scheduler.

Regards

Arjen

credmp