LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 02-24-2015, 12:22 AM   #1
tusharsharma43
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 http://exchange.mvps.org/smtp_frames.htm

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>

data<enter>
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

quit<enter>
 
Old 02-24-2015, 04:21 AM   #2
TenTenths
Senior Member
 
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6 / 7
Posts: 3,475

Rep: Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553
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
tusharsharma43
LQ Newbie
 
Registered: Jan 2010
Location: Vadodara, Gujarat
Distribution: Fedora, OpenSuse, Ubuntu, Mint and Debian
Posts: 22

Original Poster
Rep: Reputation: 0
Unhappy

Hi,

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
ehlo

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

data

Subject :- Test Subject


MIME-Version:1.0
Content-Type: multipart/mixed; boundary=attachmentbound

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



.


Quit.


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.
 
  


Reply



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

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:08 AM.

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