IMAP Cleanup (remove invisible & broken emails)

Discussion in 'IMAP Tools' started by popowich, Dec 3, 2013.

  1. popowich

    popowich EQ Forum Admin Staff Member

    Joined:
    Aug 12, 2008
    Messages:
    8,994
    Likes Received:
    120
    My work email got migrated to a new exchange server. There are three broken emails that I see with alpine over IMAP, but they are not visible in my Microsoft Outlook. Is there a way with any of these scripts to pick them off and delete them? When I try with alpine I get an access error and the program closes my connection to the IMAP server.
     


  2. rfs9999

    rfs9999 IMAP Tools

    Joined:
    Oct 27, 2013
    Messages:
    114
    Likes Received:
    6
    I would suggest doing a telnet to the Exchange server IMAP port, logging in, and trying to delete the messages manually.

    It may be that the messages are corrupt in the Exchange message store since Alpine can't delete them. If that's the case then you will have to use Exchange tools to repair or delete them. However, let's try to delete them with IMAP commands.

    Hopefully you can identify the messages by the subject or sender. Let's assume you know the subject and it is "Nice day".

    telnet server 143
    1 login user password
    1 select folder
    1 search subject "nice day"
    * SEARCH 64
    1 OK SEARCH completed

    (This response tells us the message number is 64. Mark it for deletion.)

    1 store 64 +flags \deleted

    (Repeat for the other bad messages. Then delete the messages with EXPUNGE.)

    1 expunge
    1 logout

    If Exchange lets you delete the messages then you're done. If it refuses there should be an error message that might help.

    -Rick
     

  3. popowich

    popowich EQ Forum Admin Staff Member

    Joined:
    Aug 12, 2008
    Messages:
    8,994
    Likes Received:
    120
    In my case the new server only supports port 993 so I needed this to get started:

    > openssl s_client -connect mail.my-company.com:993 -quiet

    * OK The Microsoft Exchange IMAP4 service is ready.
    1 LOGIN myUsername myPAssword

    but that is hanging and timing out eventually with:

    * BYE Connection is closed. 13

    It's my impression that I should be able to manually do commands as if I was on port 143 once connected using openssl.

    I can start a connection with openssl to different SSL enabled IMAP servers and don't have a problem logging in.

    Which leaves me wondering what that exchange server doesn't like about what I'm doing.
     
  4. rfs9999

    rfs9999 IMAP Tools

    Joined:
    Oct 27, 2013
    Messages:
    114
    Likes Received:
    6
    Maybe your Exchange mailbox is mangled and that's why your login fails to complete. And also why the deletes are failing.

    Can you create a new user in Exchange and try to access its mailbox? If that works then the problem must be with your mailbox.

    See if imapdump.pl can successfully export your messages.

    -Rick
     
  5. popowich

    popowich EQ Forum Admin Staff Member

    Joined:
    Aug 12, 2008
    Messages:
    8,994
    Likes Received:
    120
    I don't think it was me, but those 3 broken emails just disappeared. All set!

    PS: I'm not the exchange admin, I can't create new accounts etc on there.
     

Want to reply or ask your own question?

It only takes a minute to sign up (and it's free!). Click the orange sign up button to choose a username and then you can ask your own questions on the forum.
Loading...