[interchange-cvs] interchange - racke modified code/UserTag/email.tag

interchange-cvs at icdevgroup.org interchange-cvs at icdevgroup.org
Fri Jan 23 11:48:51 UTC 2009


User:      racke
Date:      2009-01-23 11:48:51 GMT
Modified:  code/UserTag email.tag
Log:
merged changes 1.14 vs 1.14.2.1
+++ 1.14.2.1 +++
Made [email] process cc and bcc options for plain text emails (#250).

Revision  Changes    Path
1.15                 interchange/code/UserTag/email.tag


rev 1.15, prev_rev 1.14
Index: email.tag
===================================================================
RCS file: /var/cvs/interchange/code/UserTag/email.tag,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- email.tag	30 Mar 2007 23:40:56 -0000	1.14
+++ email.tag	23 Jan 2009 11:48:51 -0000	1.15
@@ -5,7 +5,7 @@
 # the Free Software Foundation; either version 2 of the License, or
 # (at your option) any later version.  See the LICENSE file for details.
 # 
-# $Id: email.tag,v 1.14 2007-03-30 23:40:56 pajamian Exp $
+# $Id: email.tag,v 1.15 2009-01-23 11:48:51 racke Exp $
 
 UserTag email Order to subject reply from extra
 UserTag email hasEndTag
@@ -24,7 +24,7 @@
 sub {
     my ($to, $subject, $reply, $from, $extra, $opt, $body) = @_;
     my $ok = 0;
-    my @extra;
+    my ($cc, $bcc, @extra);
 
 	use vars qw/ $Tag /;
 
@@ -35,8 +35,12 @@
 		$from =~ s/,.*//;
 	}
 
+	# Use local copy to avoid mangling with caller's data
+	$cc = $opt->{cc};
+	$bcc = $opt->{bcc};
+
 	# Prevent header injections from spammers' hostile content
-	for ($to, $subject, $reply, $from) {
+	for ($to, $subject, $reply, $from, $cc, $bcc) {
 		# unfold valid RFC 2822 "2.2.3. Long Header Fields"
 		s/\r?\n([ \t]+)/$1/g;
 		# now remove any invalid extra lines left over
@@ -93,7 +97,8 @@
 					From => $from,
 					Subject => $subject,
 					Type => $opt->{mimetype},
-					Cc => $opt->{cc},
+					Cc => $cc,
+					Bcc => $bcc,
 					@extra_headers,
 				;
 		$opt->{body_mime} ||= 'text/plain';
@@ -177,6 +182,14 @@
 		}
 	}
 
+	if ($cc) {
+		push(@extra, "Cc: $cc");
+	}
+	
+	if ($bcc) {
+		push(@extra, "Bcc: $bcc");
+	}
+
 	$ok = send_mail($to, $subject, $body, $reply, 0, @extra)
 			unless $sent_with_attach;
 







More information about the interchange-cvs mailing list