iPhone and Exchange Server

I’ve been using an iPhone for a while, and it’s definitely a whole new experience on a phone. I’ve been enjoying it quite a bit, but perhaps I’ll write more about that later.

I have it connected to our corporate Exchange server, and the first thing I noticed was that when I would delete a message on the iPhone, it wouldn’t get deleted in Exchange.

Technically, the message gets marked for deletion in Exchange via IMAP. The problem is, it just sits there in that state until eventually someone does an EXPUNGE command on your mailbox. And even worse, when you connect Outlook to Exchange via non-IMAP methods (like whatever the default is), the message just shows up with no indication it was marked for deletion.

Well, Shawn at fresh logic studios has built a small app that will periodically run an expunge against your mail account on Exchange, and this completely solves the problem. As downloaded, it runs the command every 5 seconds; I recompiled it to instead run every 5 minutes, so as not to get my IT guys too unhappy with me.

So a HUGE thanks to Shawn for writing this – it’s a lifesaver! Highly recommended.

UPDATE 7/14/2008 – I notice a ton of traffic coming to this post over the last few days; this post was written when the only way to connect your iPhone to Exchange was via IMAP.  Using the iPhone 2.0 firmware, you can use Exchange ActiveSync, which doesn’t have the same issues as described above.

32 thoughts on “iPhone and Exchange Server

  1. Ed Martin

    As of the 1.1.1 firmware update, the problem seems to be solved. You need to go into Advanced Settings for your Exchange e-mail account on the iPhone and set the deleted items folder to the LOCAL IPHONE TRASH (in other words, do not set it to the Deleted Items folder on the Exchange server).

    This is now working for me on 2 iPhones and others that I have run across on various discussion forums.

  2. Marianne Virgili

    I tried setting my Iphone settings to sent the items to Iphone TRASH, didn’t work; then I changed to send deleted items to the deleted items folder, didn’t work Also, I went to advanced settings on the Iphone and set to delete afer 24 hours, still doesn’t work. This is so frustrating. I am having trouble downloading the application to fix this. Have a PC with Windows XP. Will it run on that? I use Exchange.

  3. gregr Post author

    Marianne – it will indeed run on XP, that’s where I’m running the expunge app. As for my sent items and deleted items, I have the iphone set to point to the corresponding folders on the Exchange server, and it’s all working ok for me.

  4. Pingback: crawlspace|media » Blog Archive » Daily Ma.gnolia Links for December 02

  5. Marianne Virgili

    When I try to run the expunge program, I get an error message — that the program has encountered an error and can’t run. I just saved the program on my desktop and try to run it from there. Even though I have my “Sent” messages from the Iphone set to show in my Outlook “Sent Items” file, they show up instead in “Sent Messages,” so then I just move them into the “Sent Items” folder because the “bcc” to myself makes for even more incoming mail. The deletion of email is a major hassle though, so I would love to get “expunge” working.

  6. Marianne Virgili

    I just noticed that messages deleted from my Iphone now appear in the “Deleted Items” file, but they still also appear in the Inbox, even when I empty the Deleted Items folder?

  7. Marianne Virgili

    I should have said that on my PC I notice the Iphone messages are in the “Deleted Items” folder, but they also remain in the Inbox, even when the Deleted folder is emptied. I think this probably has to do with the Deleted items still being available on our server for a set amount of time.

  8. gregr Post author

    Marianne – the behavior you’re seeing, with a copy of deleted items remaining in your mailbox, is exactly what the “expunge” command will take care of. Not sure why the app might not be working for you, though; you might leave a comment with the guys who wrote it (see link in this post above) and perhaps they could help you…

  9. gregr Post author

    Tony – calendar and contacts need to sync through iTunes, using a cable…no over-the-air sync for that info. I came from Windows Mobile, where both of these would sync wirelessly (unlike Blackberry, which will only sync calendar wirelessly, not contacts) – it’s certainly an inconvenience, having to use a cable, but I’ve found it’s not as bad (for me anyway) as I thought it would be. Personally, I’m willing to live with it, in exchange for all of the other things I get from the iPhone…but YMMV.

  10. Ryan

    I download the app but it just reads “running…” and never changes after I give the three pieces of information . Am I doing something wrong?

  11. gregr Post author

    Ryan – the only thing it does is flush out deleted messages so you won’t see them in Outlook and other apps. Everything else is done by the iphone itself…

  12. Ryan

    Greg Thanks for all your help! Deleted emails is working for me know, but they seem to be deleted completely from the server not sent to the deleted items folder like specified in advanced settings. Oh well, they stay on the Iphone trash if i need them.

    Just to clarify this only works for deleted emails. Correct? If i send an email from my iphone it will not show up in sent emails on the server, but only on sent on the actuall iphone. Is there a way for sent emails from the Iphone to show up in the sent file on the server? Thanks again for you help!

  13. gregr Post author

    Ryan – you need to map your “sent”, “deleted”, etc folders on the iphone to be the appropriate server folders on Exchange; you do this from the iphone mail setup somewhere. If you google, you’ll find detailed instructions how to do all that.

  14. peer

    >>(unlike Blackberry, which will only sync calendar wirelessly, not contacts)<<

    This is not correct. Blackberry syncs both Calender & Contacts wirelessly, certainly does with MS Exchange.

  15. J.P.

    gregr: i bought i phone day one. I have had the Iphone since day one, love it. However, I still have been unsuccessful in setting up my corporate email. We run MS Exchange server 2003 and Windows XP.

    I have heard so much back and forth about YES, it’s compatible, and NO, Apple made sure it wouldn’t work.

    However, all over google there’s posts and blogs about folks getting it to work, your blog being one of those that are PRO ES:




    Point being, if anyone has actually done this, I will buy them a plane ticket to sunny South Florida to hook me up…


  16. gregr Post author

    J.P. – the gating factor is whether your IT guys will enable IMAP on your Exchange server, and expose the necessary ports through your firewall. Once that is done, it works for me…

  17. Carlos F

    Everything was syncing beautiful, my Exchange server corporate email acct and my contacts from the day I connected my iphone last month. The problems started with the new update a couple of weeks ago. Since the update, I friggin can’t get all of my Outlook contacts to sync correctly. I had all 1,500+ contacts and now I can only sync about 500 of my contacts. I did a restore/sync reset today & now I can’t get my exchange server to connect :(. MAC…you’re losing me!!

  18. Frank

    @ gregr: I know this doesn’t pertain to iPhone but you mentioned BlackBerry sync. BlackBerry DOES synchronize contacts (as well as just about everything) wirelessly and has done this for quite some time. Contacts, app configurations, memos, tasks, messages, calendar entries, etc are all synchronized wirelessly unless disabled by the company’s BlackBerry administrator.

  19. John

    You can sync Tasks and Notes with Exchange 2007 using iExchange, it’s an application you can find in App Store.

  20. FAHAd

    Hi all,

    It seems everyone has the same problem. I have three questions infact:

    1. can i connect my iphone exchange server with my hotmail id?? i mean to synchronise it !!
    2. Why does it not download the attachments?? So that we can send viz blue tooth to some other device ??
    3. Blue tooth, it doesnt detect any devices near by …why ??

    Kindly clraify me ..anyone??

  21. chris

    In version 3.0 or above.
    I found that if you accept the meeting request in iPhone. You will use other person to accept. That’s ( A on behalf of You).

    This is a big bug in iPhone.

    Sometimes. iPhone may not update the update meeting request into calender……

  22. Spidertech

    It seems this blog has strayed away from the real topic. Iphone 2.0 and 3.0 still have a problem syncing deleted items to Exchange 2003 and 2007.

    Using Outlook 2007 and windows 7.

    The Deleted items setting did not fix this issue.

  23. Pingback: Why Microsoft Exchange Sucks | Zadling

Leave a Reply