Setting up a Raspberry PI as an EMAIL/WEB SERVER

Overview of TELNET

“All things appear and disappear because of the concurrence of causes and conditions. Nothing ever exists entirely alone; everything is in relation to everything else.” – The Buddha

TELNET

TELNET (short for "teletype network") is text based terminal client to an internet IP and port address to verify the commands and responses. It is used to test all sorts of basic functionality and making sure things are configured correctly.
One of the things that can be done with telnet is to test manually various email parameters to see that emails can be sent and received to verify your server is working correctly.

TELNET Installation

If telnet is not installed on your Raspbian system then you can install it with:
sudo apt-get install telnet

TELNET with POP3

To enter telnet in command mode on the email server the following command is used to connect on POP3.
telnet localhost 110
You can then log in to an email account on the server to receive or send mails with the commands below:
Note items in blue need replacing with your actual information
user myemail@mydomain.com
example
user admin@newdomain.com
then the password pass <password>
example
pass abcd1234FEGH5678
Once you are logged in then tere are several options
To list the available emails use the command list below
list
This lists each email as email number with email size in bytes.
To retrieve a specific email do it by email number as below
retr <email no>
example
retr 3
To exit telnet use quit as below.
quit

TELNET with SMTP

To connect to send emails through SMTP you can use command on the email server
telnet localhost 25
Then type
EHLO <your_domain_name>
Example
EHLO example.com
AS we are on the email server then we should not have to go through the AUTH LOGIN with user and password as we should already be authorized. This is complicated as we have to encode the user and password with base64 encoding first to enter the encoded values to the server.
type
MAIL FROM:<your_email_address>
and press Return.
Example
MAIL FROM:user1@example.com
and press Return.
You should see 250 OK
Type RCPT TO:<destination_email_address>
and press Return.
Example
MAIL FROM:jdoe@gmail.com
and press Return.
You should see “250 Accepted”
Type
DATA
and press Return.
Type
Subject:Test Message
and press Return.
Type
Test message
and press Return.
To terminate your message
Press Return.
Type
.
and press Return.
To exit telnet use quit as below.
quit