Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 02-24-2015, 12:22 AM   #1
LQ Newbie
Registered: Jan 2010
Location: Vadodara, Gujarat
Distribution: Fedora, OpenSuse, Ubuntu, Mint and Debian
Posts: 22

Rep: Reputation: 0
Mail using telnet SMTP

Hi All,

I am trying to send email using telnet to smtp as mailx and other functionality is restricted by administrator.

I am not able to figure out as how to attach any text or any file using the below.

I am following all instructions and steps as shown at

1. telnet <servername> 25
2. helo <your domain name><enter>
3. mail from: <your Email Address><enter>
response should be as follows
250 OK - mail from <your Email address>

rcpt to: <recipient address><enter>
response should be as follows
250 OK - Recipient <recipient address>

response should be as follows
354 Send data. End with CRLF.CRLF

To: <recipient's display name><enter>
From: <your display name><enter>
Subject: <Subject field of Email message><enter>
<Enter you body text><enter><enter> . <enter>
response should be as follows
250 OK

Old 02-24-2015, 04:21 AM   #2
Senior Member
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6 / 7
Posts: 2,380

Rep: Reputation: 849Reputation: 849Reputation: 849Reputation: 849Reputation: 849Reputation: 849Reputation: 849
You will need to encode the file you wish to "attach" and then create the appropriate mime/multipart headers.

Good luck with that! There's a reason mail clients were invented.
Old 02-24-2015, 07:26 AM   #3
LQ Newbie
Registered: Jan 2010
Location: Vadodara, Gujarat
Distribution: Fedora, OpenSuse, Ubuntu, Mint and Debian
Posts: 22

Original Poster
Rep: Reputation: 0


Thanks for your reply. I searched on same and found few steps, the only issue I am facing is attaching the text file.

Below is what i tried

telnet <servername> <portnumber> 25

mail from : my mail id
rcpt to : my mail id


Subject :- Test Subject

Content-Type: multipart/mixed; boundary=attachmentbound

Content-Type: application/text; name="1.txt"
Content-Transfer-Encoding: base64
aGVsbG8NCndvcmxk (*** base64 encoded of text hello world)



Here 1.txt is the text file in my home directory with content "hello"

But when I receive the mail, the attachment file 1.txt is empty.

Last edited by tusharsharma43; 02-24-2015 at 07:55 AM.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
telnet to smtp SERVER mr.cracker Linux - Server 15 06-21-2013 05:25 AM
Cant Telnet SMTP pbaker Linux - Server 9 05-28-2010 04:11 PM
PHP mail not connecting to SMTP server but can connect with telnet mrJimmbo Linux - Server 1 12-12-2006 05:51 PM
smtp problem..telnet to 25 rnj Linux - Newbie 9 12-12-2005 10:16 PM
SMTP and KMail and SMTP and Netscape Mail jazz... Linux - Newbie 5 10-11-2003 03:49 AM

All times are GMT -5. The time now is 01:52 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration