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


1 Answer 1



$ openssl smime -sign -in cleartextmail.txt -signer my_cert.pem -text \
| openssl smime -encrypt \
-from you@example.com -to someone@example.org \
-subject "Signed and Encrypted message" \
-des3 user.pem | sendmail someone@example.org

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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