The enhancement of
Item7681, allowing
WikiNames
for sender and recipient of
SendMailPlugin
, breaks if plain mail addresses are used.
In
SendMailPlugin.pm
,
sub expandEmail
, the concatenation of
@emails
returns nothing if explicit mail addresses are provided -
@emails
is only filled for wiki names.
I
guess that a mixture of plain mail addresses and wiki names should be supported?
--
TWiki:Main/HaraldJoerg
- 2016-01-18
Hmm, both should be supported, and is in use at least at two TWiki sites I know of.
Diff of code change:
--- twiki/trunk/SendMailPlugin/lib/TWiki/Plugins/SendMailPlugin.pm 2015-08-14 08:01:11 UTC (rev 29440)
+++ twiki/trunk/SendMailPlugin/lib/TWiki/Plugins/SendMailPlugin.pm 2015-08-19 05:41:05 UTC (rev 29441)
@@ -27,7 +27,7 @@
require TWiki::Plugins; # For the API version
our $VERSION = '$Rev$';
-our $RELEASE = '2015-01-22';
+our $RELEASE = '2015-08-18';
# One line description, is shown in the %SYSTEMWEB%.TextFormattingRules topic:
our $SHORTDESCRIPTION = 'Send e-mail from actions in TWiki topics, useful for workflow automation';
@@ -182,10 +182,20 @@
return '' unless( $text );
my $userEmail = join( ', ', TWiki::Func::wikinameToEmails() );
my $userWikiName = TWiki::Func::getWikiName();
- $text =~ s/\$useremail/ join( ', ', TWiki::Func::wikinameToEmails() ) /geo;
- $text =~ s/\$username/ TWiki::Func::getWikiName() /geo;
- $text =~ s/\$webmasteremail/$TWiki::cfg{WebMasterEmail}/go;
- $text =~ s/\$webmastername/$TWiki::cfg{WebMasterName}/go;
+ my @emails = ();
+ foreach my $item ( split( /, */, $text ) ) {
+ if( TWiki::Func::isValidWikiWord( $item ) ) {
+ foreach my $mail ( TWiki::Func::wikinameToEmails( $item ) ) {
+ push( @emails, "$item <$mail>" );
+ }
+ } else {
+ $item =~ s/\$useremail/$userEmail/go;
+ $item =~ s/\$username/$userWikiName/go;
+ $text =~ s/\$webmasteremail/$TWiki::cfg{WebMasterEmail}/go;
+ $text =~ s/\$webmastername/$TWiki::cfg{WebMasterName}/go;
+ }
+ }
+ $text = join( ', ', @emails );
return $text;
}
I am wondering what is wrong.
--
TWiki:Main.PeterThoeny
- 2016-01-19
OIC, the "else" is not populating the
@emails
array!
--
TWiki:Main.PeterThoeny
- 2016-01-19
I fixed the plugin.
--
TWiki:Main.PeterThoeny
- 2016-01-20