X-Git-Url: http://git.sthu.org/?a=blobdiff_plain;f=caff%2Fcaff;h=af8ae22671a4a40f85e3fa522bb403df9f04e7a6;hb=66818ae697389eea714a997da1fbec96b273cedd;hp=bb687a289b97768ce8aa38bc0d385bb0b4c19ab3;hpb=a8e7d4e7b9709d03b69b1fffb721716f4a3ebe4b;p=pgp-tools.git diff --git a/caff/caff b/caff/caff index bb687a2..af8ae22 100755 --- a/caff/caff +++ b/caff/caff @@ -245,14 +245,22 @@ Add a Reply-To: header to messages sent. Default: none. Address to send blind carbon copies to when sending mail. Default: none. -=item B [string] +=item B [array] -Send mail through specified SMTP server. Default: none (uses -sendmail). +Parameters to pass to Mail::Mailer. +This could for example be -=item B [string] + $CONFIG{mailer-send} = [ 'smtp', Server => 'mail.server', Auth => ['user', 'pass'] ] -Use specified port for sending mail to SMTP server. Default : 25. +to use the perl SMTP client or + + $CONFIG{mailer-send} = [ 'sendmail', '-o8' ] + +to pass arguments to the sendmail program. +For more information run C<< perldoc Mail::Mailer >>. +Setting this option is strongly discouraged. Fix your local MTA +instead. +Default: none. =back @@ -295,6 +303,10 @@ my $VERSION = "0.0.0.$REVISION_NUMER"; +sub mywarn($) { + my ($line) = @_; + print "[WARN] $line\n"; +}; sub notice($) { my ($line) = @_; print "[NOTICE] $line\n"; @@ -435,6 +447,8 @@ sub load_config() { $CONFIG{'no-download'} = 0 unless defined $CONFIG{'no-download'}; $CONFIG{'no-sign'} = 0 unless defined $CONFIG{'no-sign'}; $CONFIG{'key-files'} = () unless defined $CONFIG{'key-files'}; + $CONFIG{'mailer-send'} = [] unless defined $CONFIG{'mailer-send'}; + die ("$PROGRAM_NAME: mailer-send is not an array ref in $config.\n") unless (ref $CONFIG{'mailer-send'} eq 'ARRAY'); $CONFIG{'mail-template'} = <<'EOM' unless defined $CONFIG{'mail-template'}; Hi, @@ -779,14 +793,8 @@ 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); - - 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(); - } + mywarn("You have set arguments to pass to Mail::Mailer. Better fix your MTA. (Also, Mail::Mailer's error reporting is non existant, so it won't tell you when it doesn't work.)") if (scalar @{$CONFIG{'mailer-send'}} > 0); + $message_entity->send(@{$CONFIG{'mailer-send'}}); $message_entity->stringify(); };