Sometimes however you may need to send emails
without using Outlook, Agent or whatever else you use. This is how your mail software works behind the scenes,
using
SMTP.
The first step is to connect to your mail server. Open a command line, then run
telnet mail.domain.ext 25
If you establish a sucessful connection you will see something like
Connected to mail.domain.ext.
Escape character is '^]'.
220 domain.ext ESMTP MDaemon 6.7.6; Tue, 25 Mar 2003 11:37:02 +0000
The next step is to tell the mail server where you are mailing from. This is the FQDN or the IP address of your local machine
HELO local.domain.name
A well configured mail server will check you are who you say you are (so, if you lie about your machine FQDN or IP, you may well caught), then respond
250 mail.domain.ext Hello local.domain.name [a.b.c.d], pleased to meet you
Next you specify who the mail is from
MAIL FROM: mail@domain.ext
which should return
250 2.1.0 mail@domain.ext... Sender ok
Some mail servers will check that the domain you use in the MAIL FROM: command exists.
Now tell the mail server who the email is to
RCPT TO: mail@destinationdomain.ext
which should return
250 2.1.0 mail@destinationdomain.ext... Recipient ok
Now tell the mail server that you are going to send the email
DATA
Now you can start writing your email. Start by entering the email headers.
Note the space between the : terminating the header name and the value. This is mandatory.
From: Your Name
To: Their name
CC: Someone else
Subject: Your subject.
Once you finished with your header, press enter to leave a blank line before you begin
the message body, then enter your email contents.
To tell the mail server that you have completed the message enter a single "." on a line on its own.
The mail server should reply with something like
250 2.0.0 OK Message saved for delivery
You should close the connection by issuing the QUIT command. The mailserver should sign off
with something like:
221 2.0.0 mail.domain.ext closing connection
Connection closed by foreign host.