How to create and send encrypted e-mails?

I need to automate sending encrypted text messages via e-mail to a particular (always the same) recipient, who runs Apple Mail.

I’ve installed GPGTools ( on both ends, but it seems that I cannot tell via Applescript to encrypt a particular outgoing email I’m creating with Applescript, right?

So, what other options do I have?

There’s also “GPG Services”, which adds System Services for encrypting a file or text, but those come up with a user prompt, asking for the recipient’s email or key, and I cannot provide that from my script.

However, it appears that I can simply embed a PGP-encrypted text block in a plain text e-mail, meaning that if I had a way to create that text block somehow, I could simply put it into a mail and send it, all thru AppleScript. The text to insert into the mail body would look like this:

Does someone know how I could create such a PGP message by providing the unencrypted text, and either the target’s email address or its public key?

Are there perhaps command line tools that do this?

Turns out that GPGTools also installs the “gpg” command line tool. And with that, I can create the text I have to put into the mail body. Here’s an example of a shell command for that: