SMTP with telnet and attchement?

i am a beginer.How can i send email by telnet and i want to attach files too when sending emails, can you tell me how can do this? Will you please suggest some softwares for sending emails with attachements by telnet?
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

What is your mail server environement? UNIX, then the old standard PINE would fit your needs.
baburkhanAuthor Commented:
it is windows 98 and XP not unix. ummm let me tell you in detail i have an attachment, want to send it by telnet having features like i can write a message and change any data or can you tell me any good software for that or should i write telnet commands in a text and pipe them through netcat, but i dont know the procedure to attach the file (i know sending email messages by telnet at beginners level).
SMTP mail commands (telnet via port 25)

    mail from:<>
    rcpt to:<>
    From: "Bubba Joe" <>
    To: <>
    Subject: Message Text Here
    "Message body"

In order to send attachments via telnet you would have to include the base64 text of your attachment after the subject and prior to the . on a line by itself but this would not be pretty. For example, a small JPEG image might look like this inserted:

Content-Type: image/jpeg; name="image001.jpg"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="image001.jpg"
-- lines of base64 encoded image here
-- lines of base64 encoded image here
-- lines of base64 encoded image here
-- lines of base64 encoded image here
-- lines of base64 encoded image here
-- lines of base64 encoded image here
-- lines of base64 encoded image here
-- lines of base64 encoded image here
-- lines of base64 encoded image here
-- lines of base64 encoded image here

These lines will continue for the length of the attachment, not pretty.

Hope this helps.
Bootstrap 4: Exploring New Features

Learn how to use and navigate the new features included in Bootstrap 4, the most popular HTML, CSS, and JavaScript framework for developing responsive, mobile-first websites.

baburkhanAuthor Commented:
thanks but i want to know more about it. how can i encode my attachement in base64 , i tried to use mpack.exe to do so but i am not familiar with it , moreover can you tell me any software for this which asks me things, connect to telnel itself and send the email.
bbaoIT ConsultantCommented:
.exe? baburkhan, what do you want to do? to send junk mails or learn for writing your own email client... ;-))
bbaoIT ConsultantCommented:
well, if you dont want to know about base64 encoding in detail, just want to learn a way to send your attachment with telnet, i can show you a method i did successfully.
baburkhanAuthor Commented:
i want to make my own email client , mpack.exe i used to encode attachements in base64, but i dont know how to use this. well i can send emails without attachement now but please help me more with attachements , thanks.
bbaoIT ConsultantCommented:
just forget mpack.exe if you dont know how to use it. following my instructions, you can easily get the encoded text of your specific file with well-known email client - Outlook Express.

write a simple or even empty email with the file you want to attach in OE6, save it into the draft folder, save the message to a .eml file, then use notepad to open this .eml file, you may see the encoded attachment is already there, merge it with other parts of email you already edited.

as for understanding base64 encoding, refer the following:

How Base64 Encoding Works

hope it helps,
Using mpack should be fairly straightforward:

The program is activated with:

      mpack [options] -o outputfile inputfile

The most common options are:

     -s subject
     -d descriptionfile
          Include the contents of the file description in an
          introductory section at the beginning of the first
          generated message.

     -c content-type
          Label the included file as being of MIME type
          content-type, which must be a subtype of application,
          audio, image, or video.

     -o outputfile
          Write the generated message to the file outputfile.

For example, to create a mail-ready message with subject of "Test Message" and the attachment program.exe Base-64 encoded in the contents, use the command line:

mpack -s "Test Message" -d message.txt -c application -o program.b64 program.exe

Afterwards, you will have a file named program.b64 which looks like the following:

Message-ID: <??????????@unknownpc>
Mime-Version: 1.0
Subject: Test Message
Content-Type: multipart/mixed; boundary="-"

This is a MIME encoded message.  Decode it with "munpack"
or any other MIME reading software.  Mpack/munpack is available
via anonymous FTP in

The contents of the file message.txt will be inserted here

Content-Type: application/octet-stream; name="program.exe"
Content-Transfer-Encoding: base64
Content-Disposition: inline; filename="program.exe"
Content-MD5: <Base64 encoding of Program.exe will be inserted here>

Hope this helps, and please use your newfound SMTP superpowers only for good!

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
bbaoIT ConsultantCommented:
baburkhan, any feedback please?
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Email Software

From novice to tech pro — start learning today.