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

I need to send some sensitive data periodically to a set of recipients via email. Due to the nature of the data, we need to send it encrypted.

Some of our clients use PGP/GPG, so it's not an issue, but we have a few cases where the client is not allowed/does not want to use PGP, as they're already using S/MIME internally.

Is there a way to script/automate the process of encrypting and sending the email in those cases? Any tips/tricks?

For the moment, as they're not too many cases, we're solving it by emailing the PGP file to one of us and manually "converting" it to S/MIME email (basically, open PGP email, forward, send), but we'd like to do it in a "cleaner" way.

Thanks a lot


share|improve this question


$ openssl smime -sign -in cleartextmail.txt -signer my_cert.pem -text \
| openssl smime -encrypt \
-from -to \
-subject "Signed and Encrypted message" \
-des3 user.pem | sendmail
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.