There is a bug when using STARTPUBLISH/STOPPUBLISH that prevents emails from being sent (for me at least). The logic in
MailerContrib.pm (using Rev. 19211) assembles the body, headers, and footers into a variable called $tmpl, then chops that down to only what is between the STARTPUBLISH/STOPPUBLISH tags - which wipes out the headers and footers. With no headers, sendmail fails with "No recipient addresses found in message header."
Here is a diff to
MailerContrib.pm that moves the split code so that it only applies to the body, not the entire message.
--- /home/msi/vestrum/MailerContrib.pm 2010-08-19 12:04:40.968353000 -0500
+++ MailerContrib.pm 2010-08-19 12:05:40.340379901 -0500
@@ -435,33 +435,34 @@
# Handle standard formatting.
$body =~ s/%TEXT%/$text/g;
- # Don't render the header, it is preformatted
- $header = TWiki::Func::expandCommonVariables($header, $topic, $web);
- my $tmpl = "$body\n$footer";
- $tmpl = TWiki::Func::expandCommonVariables($tmpl, $topic, $web);
- $tmpl = TWiki::Func::renderText($tmpl, "", $meta);
- $tmpl = "$header$tmpl";
# REFACTOR OPPORTUNITY: stop factor me into getTWikiRendering()
# SMELL: this code is identical to PublishContrib!
# New tags
- my $newTmpl = '';
+ my $newBody = '';
my $tagSeen = 0;
my $publish = 1;
- foreach my $s ( split( /(%STARTPUBLISH%|%STOPPUBLISH%)/, $tmpl )) {
+ foreach my $s ( split( /(%STARTPUBLISH%|%STOPPUBLISH%)/, $body )) {
if( $s eq '%STARTPUBLISH%' ) {
$publish = 1;
- $newTmpl = '' unless( $tagSeen );
+ $newBody = '' unless( $tagSeen );
$tagSeen = 1;
} elsif( $s eq '%STOPPUBLISH%' ) {
$publish = 0;
$tagSeen = 1;
} elsif( $publish ) {
- $newTmpl .= $s;
+ $newBody .= $s;
}
}
- $tmpl = $newTmpl;
+ $body = $newBody;
+
+ # Don't render the header, it is preformatted
+ $header = TWiki::Func::expandCommonVariables($header, $topic, $web);
+ my $tmpl = "$body\n$footer";
+ $tmpl = TWiki::Func::expandCommonVariables($tmpl, $topic, $web);
+ $tmpl = TWiki::Func::renderText($tmpl, "", $meta);
+ $tmpl = "$header$tmpl";
$tmpl =~ s/.*?<\/nopublish>//gs;
$tmpl =~ s/%MAXREV%/$maxrev/g;
$tmpl =~ s/%CURRREV%/$maxrev/g;
--
TWiki:Main/JohnVestrum
- 2010-08-19