Batch sending s/mime encrypted email – How

batchemailencryptionmime

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

Javier

Best Answer

Try:

$ 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
Related Topic