This article is about an almost lost art. Most people know they need e-mail software to send or receive e-mail. But do they? Turns out that the bare minimum people need for sending or receiving e-mails are internet connection and telnet client, which is built into most Operating Systems.
Sending e-mails is accomplished using Simple Mail Transfer Protocol (SMTP). The SMTP server software uses Transmission Control Protocol (TCP) port number 25, so we use the telnet client to connect to the server at that port. As a note, to prevent the SMTP servers from being abused for sending junk e-mails (i.e. spamming), SMTP servers usually limit who can use them, for example only to those addressing someone within the same domain name as the SMTP server (for example, on the final leg of e-mail delivery hand over, a procedure called SMTP relay) or only to those coming from certain Internet Protocol (IP) addresses. Here’s an example on how to send an e-mail:
[someone@ws123 ~]# telnet mail.telkomsel.com 25 220 ESMTP mail.telkomsel.com HELO fgh.com 250 mailpapp1.telkomsel.co.id MAIL FROM: email@example.com 250 2.1.0 Ok RCPT TO: firstname.lastname@example.org 250 2.1.5 Ok DATA 354 end data with <CR><LF>.<CR><LF> Subject: Test command line SMTP Bla bla bla . 250 2.0.0 Ok: queued as 9C31B21C2D5 QUIT 221 2.0.0 Bye Connection closed by foreign host. [someone@ws123 ~]#
Receiving e-mails is accomplished using Post Office Protocol (POP), among others. The POP server software uses TCP port number 110, so we use the telnet client to connect to the server at that port. Here’s an example on how to receive an e-mail:
[somebody@ws789 ~]# telnet mail.xyz.com 110 +OK <email@example.com> USER somebody +OK PASS EveryoneKnowsThisPasswordExceptIlliteratePeople +OK LIST +OK 1 954 . RETR 1 +OK Return-Path: <firstname.lastname@example.org> Delivered-To: email@example.com Received: (qmail 23240 invoked by uid 89); 3 Dec 2010 10:42:55 -0000 Received: by simscan 1.4.0 ppid: 23235, pid: 23237, t: 0.0613s scanners: attach: 1.4.0 clamav: 0.96/m:52/d:8023 Received: from unknown (HELO mailpapp1.telkomsel.co.id) (22.214.171.124) by mail with SMTP; 3 Dec 2010 10:42:55 -0000 Received-SPF: neutral (mail: 126.96.36.199 is neither permitted nor denied by SPF record at _spf.fgh.com) Received: from fgh.com (dynamic-pool-telkomsel-114-124-115-28.telkomsel.net.id [188.8.131.52]) by mailpapp1.telkomsel.co.id (Postfix) with SMTP id 2A38D21C31A for <firstname.lastname@example.org>; Fri, 3 Dec 2010 17:11:33 +0700 (WIT) Subject: Test command line SMTP Message-Id: <20101203101207.2A38D21C31A@mailpapp1.telkomsel.co.id> Date: Fri, 3 Dec 2010 17:11:33 +0700 (WIT) From: email@example.com To: undisclosed-recipients:; Bla bla bla . QUIT Connection closed by foreign host. [somebody@ws789 ~]#