{"id":383,"date":"2012-07-07T08:34:31","date_gmt":"2012-07-07T08:34:31","guid":{"rendered":"http:\/\/pheonixsolutions.com\/?p=383"},"modified":"2026-09-05T10:21:49","modified_gmt":"2026-09-05T04:51:49","slug":"send-an-email-using-telnet-from-remote-servers","status":"publish","type":"post","link":"https:\/\/pheonixsolutions.com\/blog\/send-an-email-using-telnet-from-remote-servers\/","title":{"rendered":"How to Send an Email Using Telnet from a Remote Server"},"content":{"rendered":"<h2>Introduction<\/h2>\n<p class=\"isSelectedEnd\">Email delivery issues can sometimes be difficult to diagnose, especially when dealing with SMTP authentication errors, firewall restrictions, mail server configuration problems, or relay issues. One of the most effective troubleshooting techniques is sending an email directly through an SMTP server using Telnet.<\/p>\n<p class=\"isSelectedEnd\">By communicating with the mail server manually, administrators can verify SMTP connectivity, test authentication credentials, confirm mail routing, and identify potential delivery problems without relying on an email client.<\/p>\n<p class=\"isSelectedEnd\">This guide explains how to send an email using Telnet from a remote server and how to use the process for email troubleshooting.<\/p>\n<div contenteditable=\"false\">\n<hr \/>\n<\/div>\n<h2>Prerequisites<\/h2>\n<p class=\"isSelectedEnd\">Before starting, ensure that:<\/p>\n<ul data-spread=\"false\">\n<li>Telnet is installed on the server.<\/li>\n<li>You have valid SMTP credentials.<\/li>\n<li>You know the SMTP hostname and port.<\/li>\n<li>Outbound SMTP connections are allowed by the firewall.<\/li>\n<li>The mail server supports SMTP AUTH LOGIN authentication.<\/li>\n<\/ul>\n<div contenteditable=\"false\">\n<hr \/>\n<\/div>\n<h2>Step 1: Convert SMTP Credentials to Base64<\/h2>\n<p class=\"isSelectedEnd\">SMTP AUTH LOGIN requires the username and password to be encoded in Base64 format.<\/p>\n<p class=\"isSelectedEnd\">Use the following Perl commands:<\/p>\n<pre dir=\"ltr\"><code dir=\"ltr\">perl -MMIME::Base64 -e 'print encode_base64(\"test\\@domainname.com\")'<\/code><\/pre>\n<p class=\"isSelectedEnd\">Example output:<\/p>\n<pre dir=\"ltr\"><code dir=\"ltr\">dGVzdEBkb21haW5uYW1lLmNvbQ==<\/code><\/pre>\n<p class=\"isSelectedEnd\">Convert the password:<\/p>\n<pre dir=\"ltr\"><code dir=\"ltr\">perl -MMIME::Base64 -e 'print encode_base64(\"password\")'<\/code><\/pre>\n<p class=\"isSelectedEnd\">Example output:<\/p>\n<pre dir=\"ltr\"><code dir=\"ltr\">cGFzc3dvcmQ=<\/code><\/pre>\n<blockquote>\n<p class=\"isSelectedEnd\"><strong>Note:<\/strong> If your username contains special characters such as <code dir=\"ltr\">@<\/code>, escape them using a backslash (<code dir=\"ltr\">\\<\/code>) when required by the shell.<\/p>\n<\/blockquote>\n<p class=\"isSelectedEnd\">Save both Base64 values for later use.<\/p>\n<div contenteditable=\"false\">\n<hr \/>\n<\/div>\n<h2>Step 2: Connect to the SMTP Server<\/h2>\n<p class=\"isSelectedEnd\">Use Telnet to connect to the mail server.<\/p>\n<pre dir=\"ltr\"><code dir=\"ltr\">telnet mail.servername.com 25<\/code><\/pre>\n<p class=\"isSelectedEnd\">Example successful response:<\/p>\n<pre dir=\"ltr\"><code dir=\"ltr\">220 mail.servername.com ESMTP<\/code><\/pre>\n<p class=\"isSelectedEnd\">This confirms that the SMTP service is reachable.<\/p>\n<div contenteditable=\"false\">\n<hr \/>\n<\/div>\n<h2>Step 3: Introduce Yourself to the SMTP Server<\/h2>\n<p class=\"isSelectedEnd\">Send the EHLO command:<\/p>\n<pre dir=\"ltr\"><code dir=\"ltr\">EHLO servername<\/code><\/pre>\n<p class=\"isSelectedEnd\">Example response:<\/p>\n<pre dir=\"ltr\"><code dir=\"ltr\">250-mail.servername.com\n250-AUTH LOGIN PLAIN\n250 SIZE 52428800<\/code><\/pre>\n<p class=\"isSelectedEnd\">The server will display supported SMTP features and authentication methods.<\/p>\n<div contenteditable=\"false\">\n<hr \/>\n<\/div>\n<h2>Step 4: Begin SMTP Authentication<\/h2>\n<p class=\"isSelectedEnd\">Start authentication:<\/p>\n<pre dir=\"ltr\"><code dir=\"ltr\">AUTH LOGIN<\/code><\/pre>\n<p class=\"isSelectedEnd\">Server response:<\/p>\n<pre dir=\"ltr\"><code dir=\"ltr\">334 VXNlcm5hbWU6<\/code><\/pre>\n<p class=\"isSelectedEnd\">This is the Base64 prompt for the username.<\/p>\n<p class=\"isSelectedEnd\">Enter the Base64-encoded username generated earlier:<\/p>\n<pre dir=\"ltr\"><code dir=\"ltr\">dGVzdEBkb21haW5uYW1lLmNvbQ==<\/code><\/pre>\n<p class=\"isSelectedEnd\">The server will respond:<\/p>\n<pre dir=\"ltr\"><code dir=\"ltr\">334 UGFzc3dvcmQ6<\/code><\/pre>\n<p class=\"isSelectedEnd\">This is the Base64 prompt for the password.<\/p>\n<p class=\"isSelectedEnd\">Enter the Base64-encoded password:<\/p>\n<pre dir=\"ltr\"><code dir=\"ltr\">cGFzc3dvcmQ=<\/code><\/pre>\n<p class=\"isSelectedEnd\">Successful authentication response:<\/p>\n<pre dir=\"ltr\"><code dir=\"ltr\">235 Authentication succeeded<\/code><\/pre>\n<div contenteditable=\"false\">\n<hr \/>\n<\/div>\n<h2>Step 5: Send the Email<\/h2>\n<p class=\"isSelectedEnd\">After authentication, enter the following SMTP commands:<\/p>\n<pre dir=\"ltr\"><code dir=\"ltr\">MAIL FROM:&lt;sender@domain.com&gt;\nRCPT TO:&lt;recipient@example.com&gt;\nDATA<\/code><\/pre>\n<p class=\"isSelectedEnd\">The server will respond:<\/p>\n<pre dir=\"ltr\"><code dir=\"ltr\">354 End data with &lt;CR&gt;&lt;LF&gt;.&lt;CR&gt;&lt;LF&gt;<\/code><\/pre>\n<p class=\"isSelectedEnd\">Enter the message content:<\/p>\n<pre dir=\"ltr\"><code dir=\"ltr\">Subject: Test Email\n\nThis is a test email sent using Telnet.\n\n.<\/code><\/pre>\n<p class=\"isSelectedEnd\">The period (<code dir=\"ltr\">.<\/code>) on a separate line indicates the end of the message.<\/p>\n<p class=\"isSelectedEnd\">Successful response:<\/p>\n<pre dir=\"ltr\"><code dir=\"ltr\">250 Message accepted for delivery<\/code><\/pre>\n<div contenteditable=\"false\">\n<hr \/>\n<\/div>\n<h2>Step 6: Close the SMTP Session<\/h2>\n<p class=\"isSelectedEnd\">Terminate the session:<\/p>\n<pre dir=\"ltr\"><code dir=\"ltr\">QUIT<\/code><\/pre>\n<p class=\"isSelectedEnd\">Response:<\/p>\n<pre dir=\"ltr\"><code dir=\"ltr\">221 Bye<\/code><\/pre>\n<p class=\"isSelectedEnd\">The email should now be delivered to the recipient mailbox.<\/p>\n<div contenteditable=\"false\">\n<hr \/>\n<\/div>\n<h2>Example SMTP Session<\/h2>\n<pre dir=\"ltr\"><code dir=\"ltr\">telnet mail.servername.com 25\n\nEHLO servername\n\nAUTH LOGIN\n\ndGVzdEBkb21haW5uYW1lLmNvbQ==\n\ncGFzc3dvcmQ=\n\nMAIL FROM:&lt;sender@domain.com&gt;\n\nRCPT TO:&lt;recipient@example.com&gt;\n\nDATA\n\nSubject: Test Email\n\nThis is a test email.\n\n.\n\nQUIT<\/code><\/pre>\n<div contenteditable=\"false\">\n<hr \/>\n<\/div>\n<h2>Why Use Telnet for Email Troubleshooting?<\/h2>\n<p class=\"isSelectedEnd\">Using Telnet allows administrators to:<\/p>\n<ul data-spread=\"false\">\n<li>Verify SMTP connectivity.<\/li>\n<li>Test SMTP authentication.<\/li>\n<li>Check relay permissions.<\/li>\n<li>Validate sender and recipient addresses.<\/li>\n<li>Troubleshoot firewall issues.<\/li>\n<li>Identify SMTP rejection messages.<\/li>\n<li>Test mail flow without using Outlook or webmail.<\/li>\n<\/ul>\n<p class=\"isSelectedEnd\">Because responses are displayed immediately, SMTP errors can be diagnosed much faster than through traditional email clients.<\/p>\n<div contenteditable=\"false\">\n<hr \/>\n<\/div>\n<h2>Common SMTP Errors<\/h2>\n<p><strong>Authentication Failed<\/strong><\/p>\n<pre dir=\"ltr\"><code dir=\"ltr\">535 Authentication failed<\/code><\/pre>\n<p class=\"isSelectedEnd\">Possible causes:<\/p>\n<ul data-spread=\"false\">\n<li>Incorrect username<\/li>\n<li>Incorrect password<\/li>\n<li>Improper Base64 encoding<\/li>\n<\/ul>\n<div contenteditable=\"false\">\n<hr \/>\n<\/div>\n<p><strong>Relay Access Denied<\/strong><\/p>\n<pre dir=\"ltr\"><code dir=\"ltr\">554 Relay access denied<\/code><\/pre>\n<p class=\"isSelectedEnd\">Possible causes:<\/p>\n<ul data-spread=\"false\">\n<li>Authentication not completed<\/li>\n<li>Server does not allow relaying<\/li>\n<\/ul>\n<div contenteditable=\"false\">\n<hr \/>\n<\/div>\n<p><strong>Connection Refused<\/strong><\/p>\n<pre dir=\"ltr\"><code dir=\"ltr\">Connection refused<\/code><\/pre>\n<p class=\"isSelectedEnd\">Possible causes:<\/p>\n<ul data-spread=\"false\">\n<li>SMTP service is down<\/li>\n<li>Firewall blocking the port<\/li>\n<li>Wrong hostname or port<\/li>\n<\/ul>\n<div contenteditable=\"false\">\n<hr \/>\n<\/div>\n<h2>Conclusion<\/h2>\n<p>Sending email through Telnet is a simple yet powerful technique for diagnosing SMTP issues and validating mail server functionality. By manually connecting to the SMTP service, authenticating with Base64 credentials, and issuing SMTP commands, administrators can quickly determine whether email delivery problems originate from authentication failures, relay restrictions, DNS issues, or server configuration errors. This method remains one of the most effective troubleshooting tools for mail server administrators and support engineers.<\/p>\n<div contenteditable=\"false\">\n<hr \/>\n<\/div>\n<h2>Frequently Asked Questions (FAQ)<\/h2>\n<p><strong>1. Why do I need to convert credentials to Base64?<\/strong><\/p>\n<p class=\"isSelectedEnd\">SMTP AUTH LOGIN expects usernames and passwords to be transmitted in Base64 format during the authentication process. This is a standard SMTP authentication requirement.<\/p>\n<div contenteditable=\"false\">\n<hr \/>\n<\/div>\n<p><strong>2. Can I use Telnet on SMTP port 587?<\/strong><\/p>\n<p class=\"isSelectedEnd\">Yes. Many mail servers accept SMTP authentication on port 587.<\/p>\n<p class=\"isSelectedEnd\">Example:<\/p>\n<pre dir=\"ltr\"><code dir=\"ltr\">telnet mail.servername.com 587<\/code><\/pre>\n<p class=\"isSelectedEnd\">However, some servers require STARTTLS encryption before authentication.<\/p>\n<div contenteditable=\"false\">\n<hr \/>\n<\/div>\n<p><strong>3. Is Telnet suitable for production email sending?<\/strong><\/p>\n<p class=\"isSelectedEnd\">No. Telnet is primarily a troubleshooting and testing tool. For regular email delivery, use an email client, SMTP library, or application framework that supports secure authentication and encryption.<\/p>\n<div contenteditable=\"false\">\n<hr \/>\n<\/div>\n<h2>Related Articles<\/h2>\n<ol start=\"1\" data-spread=\"true\">\n<li><strong>Create an Email Account in cPanel<\/strong><br \/>\nLearn how to create, manage, and configure email accounts using the cPanel interface.<br \/>\n<a href=\"https:\/\/pheonixsolutions.com\/blog\/create-an-email-account-in-cpanel-demo\/\">Create an Email Account in cPanel<\/a><\/li>\n<li><strong>Script to Identify Bounce Back Emails<\/strong><br \/>\nAutomatically detect and analyze bounced email messages to troubleshoot delivery issues and improve email reliability.<br \/>\n<a href=\"https:\/\/pheonixsolutions.com\/blog\/script-to-identify-bounce-back-emails\/\">Script to Identify Bounce Back Emails<\/a><\/li>\n<li><strong>Send Email Using HTML Templates in CodeIgniter<\/strong><br \/>\nLearn how to create professional email templates and send HTML emails using the CodeIgniter framework.<br \/>\n<a href=\"https:\/\/pheonixsolutions.com\/blog\/send-email-using-html-templates-codeigniter\/\">Send Email Using HTML Templates in CodeIgniter<\/a><\/li>\n<\/ol>\n<div contenteditable=\"false\">\n<hr \/>\n<\/div>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction Email delivery issues can sometimes be difficult to diagnose, especially when dealing with SMTP authentication errors, firewall restrictions, mail [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[1019],"tags":[234,231,181,233,232],"class_list":["post-383","post","type-post","status-publish","format-standard","hentry","category-cloud-aws","tag-auth","tag-base64","tag-mail-2","tag-send","tag-telnet","psol-cat-cloud-aws"],"jetpack_publicize_connections":[],"jetpack_shortlink":"https:\/\/wp.me\/phn2x7-6b","jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/383","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/comments?post=383"}],"version-history":[{"count":1,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/383\/revisions"}],"predecessor-version":[{"id":11393,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/383\/revisions\/11393"}],"wp:attachment":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=383"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=383"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=383"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}