Jump to Navigation

164 - How to delete e-mails in IMAP server (openssl)

OpenSSL is an open source implementation of the SSL and TLS protocols. The core library (written in the C programming language) implements
the basic cryptographic functions and provides various utility functions. You can access to IMAP server with this tool.

1. Connect IMAP server

# openssl s_client -connect mail.myserver.com:993 -crlf -quiet

depth=2 /C=US/O=VeriSign, Inc./OU=Class 3 Public Primary Certification Authority - G2/OU=(c) 1998 VeriSign, Inc. - For authorized use only/OU=VeriSign Trust Network
verify return:1
depth=1 /C=US/O=VeriSign, Inc./OU=VeriSign Trust Network/OU=Terms of use at https://www.verisign.com/rpa (c)09/CN=VeriSign Class 3 Secure Server CA - G2
verify return:1
depth=0 /C=US/ST=California/L=Santa Fe Springs/O=Nishimoto Trading Co., LTD./OU=Terms of use at www.verisign.com/rpa (c)05/CN=mail.myserver.com
verify return:1
* OK mail.myserver.com Zimbra IMAP4rev1 service ready

2. Login to IMAP Server & Delete e-mails.

? LOGIN user password
? SELECT "Trash"
? STORE 1:* +FLAGS (\Deleted)
? EXPUNGE

? SELECT "TEMP"
? STORE 1:150 +FLAGS (\Deleted)
? EXPUNGE
? LOGOUT

Each e-mail has ID like 1, 2.... 150. "1" is the oldest among them. If you delete an e-mail, you set the flag to \Deleted first
and type "EXPUNGE" command to delete it forever.

(1:*  from first e-mail to last e-mail)

3. Other commands

? SEARCH all
? FETCH 1 body[]
? FETCH 1:5 FLAGS

If you want to take a look at the body in an e-mail, you use "FETCH" command & e-mail #.

 

Linux:


Main menu 2

Story | by Dr. Radut