Search code examples
linuxportimapfirewalliptables

Fetching external mail through the internet via IMAP in linux


I am working on a project that requires me to enable fetching of external mail through the IMAP protocol.

I was wondering if there was any way to test this from for example imap.gmail.com without using telnet (as I have to enable the IMAP port and not telnet) ?

I do apologize if this is a trivial question, but I could not locate any way to do this, thanks!


Solution

  • You can connect from the command line with this command:

    gnutls-cli --crlf -p 993 imap.gmail.com
    

    gnutls-cli establishes the TLS-encrypted connection, to port 993 (which is reserved for IMAP over TLS), and ends every line with CR LF as required by the IMAP protocol. Then you can send commands, like CAPABILITY:

    * OK Gimap ready for requests from 193.106.245.90 b136mb42616800wmb
    x CAPABILITY
    * CAPABILITY IMAP4rev1 UNSELECT IDLE NAMESPACE QUOTA ID XLIST CHILDREN X-GM-EXT-1 XYZZY SASL-IR AUTH=XOAUTH AUTH=XOAUTH2 AUTH=PLAIN AUTH=PLAIN-CLIENTTOKEN
    x OK Thats all she wrote! b136mb42616800wmb