if ( $msgnum ) { # new hotness
my $msg_template = qsearchs('msg_template', { msgnum => $msgnum } );
$customer->setfield('expdate', $expire_time);
- $error = $msg_template->send('cust_main' => $customer);
+ $error = $msg_template->send('cust_main' => $customer,
+ 'object' => $customer);
}
else { #!$msgnum, the hard way
$mail_sender = $conf->config('invoice_from', $agentnum);
my $msg_template = qsearchs('msg_template', { msgnum => $msgnum });
$cust_main->setfield('packages', \\@packages);
$cust_main->setfield('recurdates', \\@recurdates);
- $error = $msg_template->send('cust_main' => $cust_main);
+ $error = $msg_template->send('cust_main' => $cust_main,
+ 'object' => $cust_main);
}
else {
$error = $cust_main->notify( 'impending_recur_template',
use HTML::Entities qw( decode_entities encode_entities ) ;
use HTML::FormatText;
use HTML::TreeBuilder;
+use Encode;
use File::Temp;
use IPC::Run qw(run);
# @cust_msg = ('cust_msg' => $cust_msg);
# }
+ my $text_body = encode('UTF-8',
+ HTML::FormatText->new(leftmargin => 0, rightmargin => 70)
+ ->format( HTML::TreeBuilder->new_from_content($body) )
+ );
(
'custnum' => $cust_main->custnum,
'msgnum' => $self->msgnum,
'bcc' => $self->bcc_addr || undef,
'subject' => $subject,
'html_body' => $body,
- 'text_body' => HTML::FormatText->new(leftmargin => 0, rightmargin => 70
- )->format( HTML::TreeBuilder->new_from_content($body) ),
+ 'text_body' => $text_body
);
}