Take the 2-minute tour ×

What are the steps for sending an email (via SMTP) in PuTTY? Also, is it possible to attach files?

share|improve this question

migrated from stackoverflow.com Feb 12 '11 at 23:17

This question came from our site for professional and enthusiast programmers.

Are you asking about connecting directly to the SMTP server and issuing commands by hand? –  thkala Feb 12 '11 at 21:30

4 Answers 4

up vote 4 down vote accepted



enter image description here


enter image description here


enter image description here


enter image description here




share|improve this answer
+1. I never know this. Will check it how it works. :) –  Guru Feb 12 '11 at 21:41
While this answer may contain useful information about how to forward ports with Putty, it really has nothing to do with the original question –  Adam Batkin Mar 14 '11 at 17:47

Two ways:

  • Use Putty/SSH to connect to a remote Unix-like system. Then you can use mutt, pine, alpine, mail, elm, mailx and various other programs to send mail.

  • Use Putty/Telnet to connect to the remote SMTP server and issue commands manualy. This is also described here and here. Normally, this should only be done for testing reasons.

share|improve this answer

Just connect to the server using telnet and port 25, then you just type the mail commands:

HELO pcyourconnectingwith.internalorexternaldomain.com

Hit enter and usually the server will love you back.

MAIL FROM: myaddress@emailonserverifnotrelay.com
RCPT TO: detsinationemail@email.com

Usually it will tell you to have a last line with just a . when you're done.

Subject: This is the subject

Press enter twice here.

Now type the body. If you use some base64 encoder and figure how to paste that in so that it's an attachment, then you are cooler then I am.

Press enter to make sure you are on a new empty line.


At this point it should tell you that it's queued.


And that's it.

share|improve this answer

Disregard this answer Ayush have given a proper answer and I never know that setting, this answer would right if you want to send email within SHELL.

Putty has nothing to do sending email. I assume you want to send email from a UNIX server. What is the UNIX flavor you use? Try command like mail or mailx. Then you may try uuencode option with the mail command.

The options:

mailx [-s subject] [-a attachment ]  [-r from-addr] to-addr . . .
   -s   subject of email (could be inserted later)
   -r   indicates the email's sender (not a standard argument)
   -a   file to be attached to email (in some versions only, please check man pages of mailx for your platform)
   -a   specify additional header fields (in other versions)


echo "Some message for email body" | mailx -s "meeting today" somebody@example.com

To send attachment you would do:

( cat mesgfile.txt; uuencode Test.dat Test.dat ) | mailx -s 'Testing' mymail@yexample.com

The uuencode command takes two parameters. 1: the file you want to send, 2: name you want to send.

share|improve this answer

Your Answer


