since I posted my verifying and decryting script here is the counterpart my signing and encryting script:
- Code: Select all
{ ### GnuPG (Version 1.2.4) sign and encrypt Mail Body
{ by Christian Gerwig <christian@gerwig.com> last change: 16.09.04
{ Script to sign an outgoing message with the ability to control the script via
{ the User Header.
{ By default every message will be signed. If you don't like this feature uncomment line 19
{ If no secret key is available for the address the script aborts
{ If you want to control it go to the optional tab in the compose
{ window and in the "User Header" field enter
{ pgp: n -> no pgp for the message
{ pgp: s -> for signing the message
{ pgp: e -> for encrypting the message
{
{ !!! Make sure to update the path to your gpg.exe in the next line for your system!!!
set $GPGexe "c:\programme\gnupg\gpg.exe"
ReadHeader $pgp "pgp:" %message
If "n" ^ $pgp then end
If "s" ^ $pgp then sign_message
If "e" ^ $pgp then encrypt_message
{Exit
:sign_message
ReadRawBody $a %message
AddStrings $SIGFile $ScriptPath "sigtemp.txt"
SaveBody $a $SIGFile
ReadEmail $From
set $command "--default-key "
AddStrings $command $From " --clearsign " $ScriptPath "sigtemp.txt"
ExecuteAndWait $GPGexe $command #error
if #error > 0 then error_sign
AddStrings $ASCFile $ScriptPath "sigtemp.asc"
OpenBody $a $ASCFile
AssignBody %message $a
DeleteFile $SIGFile
DeleteFile $ASCFile
Exit
:encrypt_message
ReadRawBody $a %message
AddStrings $SIGFile $ScriptPath "sigtemp.txt"
SaveBody $a $SIGFile
ReadTo $t %message
GetLine $To 0 $t
Set $Email $To
set $command "-r "
AddStrings $command $To " -a --encrypt " $ScriptPath "sigtemp.txt"
ExecuteAndWait $GPGexe $command #error
if #error > 0 then error_encrypt
AddStrings $ASCFile $ScriptPath "sigtemp.asc"
OpenBody $a $ASCFile
AssignBody %message $a
DeleteFile $SIGFile
DeleteFile $ASCFile
Exit
:error_sign
Set $e "Signing ERROR! No secret key found for "
AddStrings $e $From
MessageBox $e
DeleteFile $SIGFile
Exit
:error_encrypt
Set $e "Encryting ERROR! No public key found for "
AddStrings $e $To
MessageBox $e
DeleteFile $SIGFile
:end
Exit
You only have to place in the user defined header fields pgp and the letter what you want to do with this message. By default all messages are signed. I think this is a good idea during these days where spam and viruses are filling our mailboxes.
Do not forget to set the filter for all outgoing mails to run this script.
I hope you like it. Suggestions and corrections are welcome.