[Rt-commit] r7517 - in rt/branches/3.7-EXPERIMENTAL: .
ruz at bestpractical.com
ruz at bestpractical.com
Mon Apr 16 09:04:44 EDT 2007
Author: ruz
Date: Mon Apr 16 09:04:43 2007
New Revision: 7517
Modified:
rt/branches/3.7-EXPERIMENTAL/ (props changed)
rt/branches/3.7-EXPERIMENTAL/lib/RT/Interface/Email.pm
Log:
r4937 at cubic-pc: cubic | 2007-04-16 14:33:41 +0400
* SendEmailUsingTemplate
Modified: rt/branches/3.7-EXPERIMENTAL/lib/RT/Interface/Email.pm
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/lib/RT/Interface/Email.pm (original)
+++ rt/branches/3.7-EXPERIMENTAL/lib/RT/Interface/Email.pm Mon Apr 16 09:04:43 2007
@@ -433,6 +433,45 @@
return 1;
}
+=head2 SendEmailUsingTemplate Template => '', Arguments => {}, To => '', Cc => '', Bcc => ''
+
+Sends email using a template, takes name of template, arguments for it and recipients.
+
+=cut
+
+sub SendEmailUsingTemplate {
+ my %args = (
+ Template => '',
+ Arguments => {},
+ To => undef,
+ Cc => undef,
+ Bcc => undef,
+ @_
+ );
+
+ my $template = RT::Template->new( $RT::SystemUser );
+ $template->LoadGlobalTemplate( $args{'Template'} );
+ unless ( $template->id ) {
+ $RT::Logger->error("Couldn't load template '". $args{'Template'} ."'");
+ return 0;
+ }
+ $template->Parse( %{ $args{'Arguments'} } );
+
+ my $msg = $template->MIMEObj;
+ return 0 unless $msg;
+
+ $msg->head->set( $_ => $args{ $_ } )
+ foreach grep defined $args{$_}, qw(To Cc Bcc);
+
+ return SendEmail( Entity => $msg );
+}
+
+=head2 ForwardTransaction TRANSACTION, To => '', Cc => '', Bcc => ''
+
+Forwards transaction with all attachments 'message/rfc822'.
+
+=cut
+
sub ForwardTransaction {
my $txn = shift;
my %args = ( To => '', Cc => '', Bcc => '', @_ );
More information about the Rt-commit
mailing list