summaryrefslogtreecommitdiff
path: root/FS/FS/msg_template
diff options
context:
space:
mode:
authorMark Wells <mark@freeside.biz>2016-03-23 11:46:41 -0700
committerMark Wells <mark@freeside.biz>2016-03-23 11:46:49 -0700
commit871700058406b65d66bfcf645e4546fafb132246 (patch)
treeb9010c0797411886f32af50ec4b79a7c66b77bdf /FS/FS/msg_template
parent7109ab0b7108ee365fbc958eaaf9e473f2332c08 (diff)
add event action to send an invoice attached to a notice, #40152
Diffstat (limited to 'FS/FS/msg_template')
-rw-r--r--FS/FS/msg_template/email.pm21
1 files changed, 19 insertions, 2 deletions
diff --git a/FS/FS/msg_template/email.pm b/FS/FS/msg_template/email.pm
index 83ff18f19..07a1fa093 100644
--- a/FS/FS/msg_template/email.pm
+++ b/FS/FS/msg_template/email.pm
@@ -206,6 +206,12 @@ A string to use as the HTML body; if specified, replaces the entire
body of the message. This should be used ONLY by L<FS::report_batch> and may
go away in the future.
+=item attach
+
+A L<MIME::Entity> (or arrayref of them) to attach to the message.
+
+=cut
+
=back
=cut
@@ -348,13 +354,24 @@ sub prepare {
'Type' => 'multipart/related',
);
+ if ( $opt{'attach'} ) {
+ my @attach;
+ if (ref $opt{'attach'} eq 'ARRAY') {
+ @attach = @{ $opt{'attach'} };
+ } else {
+ @attach = $opt{'attach'};
+ }
+ foreach (@attach) {
+ $message->add_part($_);
+ }
+ }
+
#$message->head->replace('Content-type',
# 'multipart/related; '.
# 'boundary="' . $message->head->multipart_boundary . '"; ' .
# 'type=multipart/alternative'
#);
-
- # XXX a facility to attach additional parts is necessary at some point
+
foreach my $part (@{ $email{mimeparts} }) {
warn "$me appending part ".$part->mime_type."\n" if $DEBUG;
$message->add_part( $part );