caff: support using a SMTP-server to send out the mails instead
[pgp-tools.git] / caff / caff
index bec7b74b1eb6c8fcac28473a88e6842d058e93ca..bb687a289b97768ce8aa38bc0d385bb0b4c19ab3 100755 (executable)
--- a/caff/caff
+++ b/caff/caff
@@ -50,7 +50,8 @@ CA Fire and Forget is a script that helps you in keysigning.  It takes a list
 of keyids on the command line, fetches them from a keyserver and calls GnuPG so
 that you can sign it.  It then mails each key to all its email addresses - only
 including the one UID that we send to in each mail, pruned from all but self
-sigs and sigs done by you.
+sigs and sigs done by you.  The mailed key is encrypted with itself as a means
+to verify that key belongs to the recipient.
 
 =head1 OPTIONS
 
@@ -244,6 +245,15 @@ Add a Reply-To: header to messages sent. Default: none.
 Address to send blind carbon copies to when sending mail.
 Default: none.
 
+=item B<smtp-server> [string]
+
+Send mail through specified SMTP server. Default: none (uses
+sendmail).
+
+=item B<smtp-port> [string]
+
+Use specified port for sending mail to SMTP server. Default : 25.
+
 =back
 
 =head1 AUTHORS
@@ -769,7 +779,14 @@ sub send_mail($$$@) {
        $message_entity->head->add("Reply-To", $CONFIG{'reply-to'}) if defined $CONFIG{'reply-to'};
        $message_entity->head->add("Bcc", $CONFIG{'bcc'}) if defined $CONFIG{'bcc'};
        $message_entity->head->add("User-Agent", $USER_AGENT);
-       $message_entity->send();
+
+       if($CONFIG{'smtp-server'}) {
+               $message_entity->smtpsend(Host => $CONFIG{'smtp-server'},
+                       ($CONFIG{'smtp-port'} ? (Port => $CONFIG{'smtp-port'}) : ()),
+                       MailFrom => $CONFIG{'email'});
+       } else {
+               $message_entity->send();
+       }
        $message_entity->stringify();
 };