Talking IMAP4 (to do test for Dekko2 config) with OpenSSL



  • For those who must/will check the IMAP config values (what I have had to do last night) I've here en example how to talk IMAP4 with a remote server using OpenSSL's s_client:

    
    $ openssl s_client -crlf -connect pod51010.outlook.com:993
    ...
    * OK The Microsoft Exchange IMAP4 service is ready. [QgBOADcAUABSADAANQBDAEEAMAAwADEAOAAuAG4AYQBtAHAAcgBkADAANQAuAHAAcgBvAGQALgBvAHUAdABsAG8AbwBrAC4AYwBvAG0A]
    

    note the above code in [....] can be decoded with

    $ mmencode -u
    BN7PR05CA0018.namprd05.prod.outlook.com
    

    talking IMAP.... all one line commands below start with a . (dot):

    . capability
    * CAPABILITY IMAP4 IMAP4rev1 AUTH=PLAIN AUTH=XOAUTH2 SASL-IR UIDPLUS MOVE ID UNSELECT CHILDREN IDLE NAMESPACE LITERAL+
    . OK CAPABILITY completed.
    
    
    . login yourmail@server.com yourpassword
    . OK LOGIN completed.
    
    . status INBOX (messages)
    * STATUS INBOX (messages 1385)
    . OK STATUS completed.
    
    . select INBOX
    * 1385 EXISTS
    * 0 RECENT
    * FLAGS (\Seen \Answered \Flagged \Deleted \Draft $MDNSent)
    * OK [PERMANENTFLAGS (\Seen \Answered \Flagged \Deleted \Draft $MDNSent)] Permanent flags
    * OK [UIDVALIDITY 14] UIDVALIDITY value
    * OK [UIDNEXT 339858] The next unique identifier value
    . OK [READ-WRITE] SELECT completed.
    
    . fetch 1 rfc822.text
    * 1 FETCH (RFC822.TEXT {1154}
    ... (lots of mmencoded lines deletec) ....
     FLAGS (\Seen))
    . OK FETCH completed.
    
    . logout
    * BYE Microsoft Exchange Server IMAP4 server signing off.
    . OK LOGOUT completed.
    read:errno=0
    

    store the above mmencoded lines into a file msg and run:

    $ mmencode -u < msg
    Try webmail undelete could be an option this is only available for the first 24 hours of deletion from what I can recall
    -----Original Message-----
    From: ....
    Sent: 19 May 2017 13:38
    To: Apitz,Matthias ....
    Subject: RE: lost my inbox
    
    Hi Matthias, if those mails are not in your Deleted Items, then you need to get in touch with US via SN so Exchange admins can do a recovery of your mailbox.
    ...
    

    HIH

    matthias


Log in to reply