Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 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
up vote 4 down vote accepted


1) In the "Session" screen under "Host Name" you will need to specify your domain name. For "Protocol", you will need to select SSH.

enter image description here

2) Next, you will need to click on "Connection" in the Category menu on the left, click "SSH", then click "Tunnels".

enter image description here

3) Now, set up the tunnel for POP3 (used for receiving email). On this screen, in the "Add new forwarded port:" section, you will need to specify "5110" (without the quotes) for Source Port and (where "" is replaced by your actual domain name) for the Destination, as shown below. Make sure "Local" is selected, then click "Add".

enter image description here

4) Next, we need to set up the tunnel for SMTP (used for sending email). On the same screen as above, again under "Add new forwarded port", you will need to enter "5025" (without the quotes) for Source Port and (where "" is replaced by your actual domain name) for the Destination, as shown below. Leave "Local" selected and click "Add".

enter image description here

5)now go back to the "Session" category in the menu on the left. Under "Saved Sessions" you will need to fill in a name to refer to the configuration options you've just set so that you will be able to easily load them in future sessions. We have chosen to name this default session "SecureEmail". Once you have entered the name, click on "Save". Your settings will be stored and you should now see the name of your session listed in the Default Settings box.

To open the tunnel, you will simply need to double-click the session name (or click once to highlight the session name and choose "Open").

6)Once you have done so, an SSH window will open up and you will be asked for your account access information. The username and password you enter will need to be that of your FutureQuest account, the same information you use to login to your CNC or use in your FTP client. After entering your username and password, you will not need to do anything else on this screen. However, you do need to keep it OPEN.

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

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


Hit enter and usually the server will love you back.


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

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

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"

To send attachment you would do:

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

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

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .