• Do not register here on develop.twiki.org, login with your twiki.org account.
• Use View topic Item7848 for generic doc work for TWiki-6.1.1. Use View topic Item7851 for doc work on extensions that are not part of a release. More... Close
• Anything you create or change in standard webs (Main, TWiki, Sandbox etc) will be automatically reverted on every SVN update.
Does this site look broken?. Use the LitterTray web for test cases.

Item7716: SendMailPlugin no longer works with plain mail addresses

Item Form Data

AppliesTo: Component: Priority: CurrentState: WaitingFor: TargetRelease ReleasedIn
Extension SendMailPlugin Normal Closed   n/a  

Edit Form Data

Summary:
Reported By:
Codebase:
Applies To:
Component:
Priority:
Current State:
Waiting For:
Target Release:
Released In:
 

Detail

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

ItemTemplate
Summary SendMailPlugin no longer works with plain mail addresses
ReportedBy TWiki:Main.HaraldJoerg
Codebase ~twiki4, 6.0.2
SVN Range TWiki-6.0.2-trunk, Sun, 10 Jan 2016, build 29797
AppliesTo Extension
Component SendMailPlugin
Priority Normal
CurrentState Closed
WaitingFor

Checkins TWikirev:29909 TWikirev:29910 TWikirev:29911 TWikirev:29912
TargetRelease n/a
ReleasedIn

Edit | Attach | Watch | Print version | History: r3 < r2 < r1 | Backlinks | Raw View |  Raw edit | More topic actions
Topic revision: r3 - 2016-01-20 - PeterThoeny
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback