X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fmsg_template.pm;h=70e5569249e195d33e27ed9550275723fddf831c;hb=1f1c0ad8798bfaea287c47565f1a565ee7d82e5c;hp=5c6392cfc921ec6dce4ec0296d21cb88ad04eb6b;hpb=4e091a88af83ba9293a1747aaf754439dcc4cd39;p=freeside.git diff --git a/FS/FS/msg_template.pm b/FS/FS/msg_template.pm index 5c6392cfc..70e556924 100644 --- a/FS/FS/msg_template.pm +++ b/FS/FS/msg_template.pm @@ -422,7 +422,7 @@ sub prepare { 'bcc' => $self->bcc_addr || undef, 'subject' => $subject, 'html_body' => $body, - 'text_body' => $text_body + 'text_body' => $text_body, ); } @@ -430,7 +430,8 @@ sub prepare { =item send OPTION => VALUE Fills in the template and sends it to the customer. Options are as for -'prepare'. +'prepare', plus 'attach', a L (or arrayref of them) to attach +to the message. =cut @@ -438,7 +439,20 @@ Fills in the template and sends it to the customer. Options are as for # preview it, etc. sub send { my $self = shift; - send_email(generate_email($self->prepare(@_))); + my %opt = @_; + + my %email = generate_email($self->prepare(%opt)); + if ( $opt{'attach'} ) { + my @attach; + if (ref($opt{'attach'}) eq 'ARRAY') { + @attach = @{ $opt{'attach'} }; + } else { + @attach = $opt{'attach'}; + } + push @{ $email{mimeparts} }, @attach; + } + + send_email(%email); } =item render OPTION => VALUE ...