summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/TUWF.pod3
-rw-r--r--lib/TUWF/Misc.pm4
2 files changed, 6 insertions, 1 deletions
diff --git a/lib/TUWF.pod b/lib/TUWF.pod
index a769423..2332321 100644
--- a/lib/TUWF.pod
+++ b/lib/TUWF.pod
@@ -576,6 +576,9 @@ L<mail()|TUWF::Misc>. Default: C<E<lt>noreply-yawf@blicky.netE<gt>>.
The path to the C<sendmail> command, used by L<mail()|TUWF::Misc>. Default:
C</usr/sbin/sendmail>.
+Can also be set to the string C<"log">, in which case the emails will be
+written to the TUWF log function instead of actually being sent.
+
=item max_post_body
Maximum length of the contents of POST requests, in bytes. This disallows
diff --git a/lib/TUWF/Misc.pm b/lib/TUWF/Misc.pm
index edea8de..dc26e88 100644
--- a/lib/TUWF/Misc.pm
+++ b/lib/TUWF/Misc.pm
@@ -181,7 +181,9 @@ sub TUWF::Object::mail {
}
$mail .= sprintf "\n%s", $body;
- if(open(my $mailer, '|-:utf8', "$self->{_TUWF}{mail_sendmail} -t -f '$hs{From}'")) {
+ if($self->{_TUWF}{mail_sendmail} eq 'log') {
+ $self->log("tuwf->mail(): The following mail would have been sent:\n$mail");
+ } elsif(open(my $mailer, '|-:utf8', "$self->{_TUWF}{mail_sendmail} -t -f '$hs{From}'")) {
print $mailer $mail;
croak "Error running sendmail ($!)"
if !close($mailer);