Grep emailaddress from IMAP dir with UNDELIVERABLE messages

Case

You send newsletter and get a hole buns of UNDELIVERABLE email back in your INbox. You find this irritating and want to cleanup your newsletter database.

To do so you probably need a list with all email addresses you want to un-subscribe.

Solution

  • First create a new IMAP directory.

Test IMAP login over Telnet

To test a IMAP connection and login over telnet use this commands.

To quickly test an imap server using telnet use:
telnet server 143
01 LOGIN username password
02 LIST "" *
03 SELECT mailbox

Line 02 shows you all available mailboxes.

To show the information about a mailbox:
04 STATUS mailbox (MESSAGES)