Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

A few days ago I asked about how I can secure email and many people advised me to use PGP tool, and I read about it and I use it.

Now I want to write a batch file to send encrypted email with attachments. I know how I can generate key, exchange key with other side and encrypt email with PGP mail but until now I don't know how I can integrate PGP tool with my mail and how I can send the encrypted email.

In other words, how can I send encrypted email that encrypts with PGP tool to other side by command line (batch file)?

share|improve this question
up vote 3 down vote accepted

Many clients support an extension for PGP. You could use Enigmail with Thunderbird for instance.

share|improve this answer

As an absolute last resort, you could install cygwin and then install mutt. You can do it all via a shell script (shell/bash also comes with cygwin).

See this thread for details:

** Note ** There is probably a much better (more Windows-native) way of doing this on your system since you aren't running *nix. But if no other alternatives come up, this approach should work.

share|improve this answer

If you can run Perl and PGP/GNUPG from the command line, then modifying part of this PGP Form Mail script may be of interest.

share|improve this answer

There are a number of GnuPG frontends recommended on the GPG homepage, including sections for network interfaces, scripting interfaces and Windows-specific sofware.

share|improve this answer

I was able to incorporate pgp into outlook 2007 using a combination of vbs and bat all together. It is a self contained folder. However, I was using pgp 6.5.8 to do this. The only issue with this process was it had extra space at the end of the CRLF. My work around was to attach the encrypted file to the MS outlook. Which was added in the script to attach the file automatically after it was encrypted. This script was built from ms dos and able to use in other email platforms.


share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.