I am subscribed to a ADSL provider who also provides Email services. Hence, I could try to send some mail from the command line on my laptop.
As a first step, I started a telnet session with the provider: from the command line I gave the command: “telnet mail.wxs.nl 25”. The server responded promptly. As response I received: “220 CPSMTPM-CMT103.kpnxchange.com kpnxchange.com Fri, 24 Dec 2010 00:03:22 +0100”.
My next command was “helo mail.wxs.nl” to contact the mail server. The reply from the mail server was: “250 CPSMTPM-CMT101.kpnxchange.com Hello [22.214.171.124]”.
As sender, I introduced: “mail from: firstname.lastname@example.org”. Apparently I was accepted as a legal sender as the server replied: “250 2.1.0 email@example.com….Sender OK”.
I decided to send a mail to my-self: “rcpt to: firstname.lastname@example.org”.
To start the email, I had to issue the command “data”, upon which the server asked me to start the mail content: “354 Please start mail input.”.
The mail content started with a subject line: “Subject: test mail”. After this the mail body could be issued: “this is a test”.
The mail content was finished by a dot “.” on a line.
After this, the mail was queued for delivery. This was indicated by a response from the mail server: “250 Mail queued for delivery.”. After that I gave “quit” upon which the actual mail was sent.
What is the benefit of this exercise? At least, it shows me a way to send Emails from the command line. This could also be used to write a program that could send Emails automatically. Such a program should be able to send output to the command line. If similar lines like above would be send, an Email would be sent. This could then be used as a warning mechanism.