Sitemap
enekochan

Programming and Technology

Follow publication

Send email with SMTP and Plain Auth via telnet

First connect to the server. It’s usualy on port 25 but this can change from server to server:

telnet server.com 25

Then say hello:

EHLO server.com

Say you will be providing plain auth:

AUTH LOGIN

The server will ask you for your username (it replies 334 VXNlcm5hbWU6 which is 334 Username: encoded in base64). Then give your base64 encoded user name. You can use this web to encode it: http://www.base64encode.org/

dXNlcm5hbWU=

Now the server will ask you for your password (it replies 334 UGFzc3dvcmQ6 which is 334 Password: encoded in base64). Give your base64 encoded password:

cGFzc3dvcmQ=

It should anser something like this:

235 Authentication succeeded

Now send the email as usual:

MAIL FROM: from@server.com
RCPT TO: destination@otherserver.com
DATA
Subject: Hello

Your message
.

Note: If you supply an email subject you have to press enter twice before starting with the actual message.

This is how it should look everything together:

$ telnet server.com 25
Trying 97.53.12.9...
Connected to server.com.
Escape character is '^]'.
220-server.com ESMTP Exim 4.80 #2 Wed, 12 Feb 2014 13:37:51 +0100
220-We do not authorize the use of this system to transport unsolicited,
220 and/or bulk e-mail.
EHLO server.com
250-server.com Hello 32.92-10-25.blabla.tururu.com [92.10.25.32]
250-SIZE 52428800
250-8BITMIME
250-PIPELINING
250-AUTH PLAIN LOGIN
250-STARTTLS
250 HELP
AUTH LOGIN
334 VXNlcm5hbWU6
dXNlcm5hbWU=
334 UGFzc3dvcmQ6
cGFzc3dvcmQ=
235 Authentication succeeded
MAIL FROM: me@server.com
250 OK
RCPT TO: you@otherserver.com
250 Accepted
DATA
354 Enter message, ending with "." on a line by itself
SUBJECT: Hi!

Test
.
250 OK id=1WDZ6R-0008KT-Nx

Ref: http://www.ndchost.com/wiki/mail/test-smtp-auth-telnet

Medium Logo
Medium Logo

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

No responses yet

Write a response