Testing client web applications and websites often means migrating them temporarily to my development network for testing purposes. This means changing email server settings to ensure no emails escape from captivity, which would be embarrassing.
Occasionally I have issues with my internal email configuration and need to do a quick test to see if my internal email server is receiving emails from my website development servers. This can easily be achieved using the command line and telnet.
First off we need to esablish a connection to the email server, so telnet into your SMTP server from the command line like so:
telnet [ip-address] 25
Where ip address is your email server e.g “telnet 10.10.10.1 25″. The 25 signifies your SMTP port, 25 is the default.
We now need to check if the SMTP server is alive. So we can use:
EHLO
What you get back depends on your SMTP server, OS etc. but you should get an OK message at least.
Now we want to send a test message to see if our SMTP server is receving email okay from our local network. To do this we need to tell it the email sender, email recipient and of course the message. The message is in two parts – subject and body (although you dont have to fill in the subject as it is not mandatory). We do this using:-
mail from:email@emailsender.com
rcpt to:email@yourdomain.com
To send the actual message we need to type the command:
Data
Followed by a carriage return (enter).
To enter the subject we use:
Subject: Subject goes here
Then press enter TWO times.
You can now start typing the body of your email message. To finish the email body text input, enter a carriage return (enter) and then tpye a period (.) followed by carriage reutrn (enter) again.
Finally enter:
quit
To exit the telnet program.
You should get an OK or message queued for delivery message back saying that the SMTP server has accepted the message. If not you have entered something wrong, or the email server doesnt like the message (for example an email relay config issue blocking you sending from your IP address).
Hope that is of help.
