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 16 Oct 2026

Building a Windows 11 gold template

Learn how to create a Windows 11 gold template in Proxmox for VDI environments, allowing for efficient desktop pool management. This guide is aimed at engineers and includes steps for setting up, configuring, and testing the template.

Knowledge base 10 Oct 2026

eLLA - Settings, Options and Skills Reference

eLLA is a command-line assistant for system administration. It connects to an eLLM endpoint (any OpenAI-compatible API with tool calling), runs read-only diagnostics on its own, and asks for approval before it changes anything. This article lists every setting, command, option and bundled skill.

Knowledge base 23 Sep 2026

eSAM and exam regulations

eSAM addresses every requirement in JCQ Appendix 1 that software can address. The rest, who is sitting there, how the room is laid out, how many invigilators are watching stay with the centre, and eSAM tells you exactly which those are.

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.