How can I make an encrypted email message into a .p7m file?

Posted by Blacklight Shining on Super User See other posts from Super User or by Blacklight Shining
Published on 2012-07-08T07:38:41Z Indexed on 2012/07/08 9:17 UTC
Read the original article Hit count: 255

Filed under:
|
|
|
|

This is a bit complicated, so I'll explain what I'm really trying to do here: I have a Debian server, and I want to automatically email myself certain logs every week. I'm going to use cron and a bash script to copy the logs into a tarball shortly after midnight every Monday. A bash script on my home computer will then download the tarball from the server, along with a file to be used as the body of the email, and call an AppleScript to make a new email message.

This is where I'm stuck—I can't find a way to encrypt and sign the email using AppleScript and Apple's mail client. I've noticed that if I put a delay in before sending the message, Mail will automatically set it to be encrypted and signed (as it normally does when I compose a message myself). However, there's no way to be sure of this when the script runs—if something goes wrong there, the script will just blindly send the email unencrypted.

My solution there would be to somehow manually create a .p7m file with the tarball and message and attach it to the email the AppleScript creates. Then, when I receive it, Mail will treat it just like any other encrypted message with an attachment (right?)

If there's a better way to do this, please let me know. ^^ (Ideally, everything would be done from the server, but there doesn't seem to be a way to send mail automatically without storing a password in plaintext.)

(The server is running Debian squeeze; my home computer is a Mac running OS X Lion.)

© Super User or respective owner

Related posts about email

Related posts about osx-lion