Testing SMTP from CLI

By EssingtonITS team ·

Learn how to test SMTP from the command line by connecting to a mail server, sending a test email, and troubleshooting common errors. This guide covers the essential commands and steps for successful email transmission.

To gain access to your email account, you will need the following three essentials:
  • A stable and active internet connection
  • The address of a mail server that can handle relaying, which is usually provided by your email service provider (e.g., mail.domain.ext)
  • A legitimate email address (e.g., mail@domain.ext)
Utilize the command line interface to initiate a connection from your computer to your designated mail server.
 
telnet mail.domain.ext 25
 
You should receive a response that looks something like this:
 
Trying ???.???.???.???... Connected to mail.domain.ext. Escape character is '^]'. 220 mail.domain.ext ESMTP Sendmail ?version-number?; ?date+time+gmtoffset?
 
Proceed by indicating the origin of your email:
 
HELO local.domain.name
 
The exact local domain name is not critical, though using your fully qualified domain name as recognized externally is recommended. The mail server needs to trust your input as per the standards set by RFC822-RFC1123.
 
Reply 250 mail.domain.ext Hello local.domain.name [loc.al.i.p], pleased to meet you
 
Next, enter your email address:
 
MAIL FROM: mail@domain.ext
 
Reply
 
250 2.1.0 mail@domain.ext... Sender ok
 
Now, input the recipient's email address:
 
 
Reply
 
250 2.1.0 mail@otherdomain.ext... Recipient ok
 
To start composing your email message, use the following command:
 
DATA If you wish to include a subject for your email, type Subject:-type subject here- then press enter twice (these are required to comply with RFC 882) You can now proceed to write the body of your message.
 
 This is a test email
 
To signal to the mail server that you have completed your message, enter a single period
 
 .
 
Reply
 
250 2.0.0 ???????? Message accepted for delivery.
 
To close the connection, use the following command:
 
QUIT
 
Reply
 
221 2.0.0 mail.domain.ext closing connection Connection closed by foreign host.
 
Errors
  • 501 nouser@nosuchplace.here... Sender domain must exist
  • 503 Need MAIL before RCPT - A recipient has been specified before a sender.
  • 550 mail@domain.ext... Relaying Denied - The mail server has refused to relay mail for you.

Looking to enhance your Linux infrastructure? At EssingtonITS.co.uk, we offer expert support and tailored solutions to optimise your systems. Let us help you achieve seamless integration and improved performance.

person people found this useful.

Related

Knowledge base 10 Jun 2026

Personal Notebook in eLLM

The personal notebook in eLLM allows users to organise and store notes, images, and files in a private, searchable timeline. It ensures privacy by keeping contents visible only to the user, and it can be integrated with the assistant for personalised answers.

Knowledge base 9 Jun 2026

Git Commands Quick Reference Guide

This quick reference guide covers essential Git commands for repository setup, staging, branching, merging, and working with remote repositories, making it a handy tool for developers to streamline their workflow.

Knowledge base 9 Jun 2026

Organisation Skills in the eLLM Admin Console

The article explains how the eLLM Admin Console allows organisations to create and manage shared instruction sets called "organisation skills" to ensure consistent responses across teams. These skills can be customised, restricted to specific groups, and integrated with extern…

Expand 29 Jul 2026

How AI can support pupils with SEND

Explore how AI tools are aiding pupils with special educational needs and disabilities by simplifying text, breaking down tasks, and enhancing accessibility. Learn about the considerations schools should make before implementation.

Expand 29 Jul 2026

AI policy and practice in further education

Further education colleges need distinct AI policies due to their unique mix of vocational courses, diverse age groups, and specific funding and inspection requirements. This guidance highlights the importance of tailored AI approaches in FE settings.