unshift @mimeparts, {
'Type' => ( $options{'content-type'} || 'text/plain' ),
- 'Data' => $options{'body'},
+ 'Charset' => 'UTF-8',
+ 'Data' => ( $options{'content-type'} =~ /^text\//
+ ? Encode::encode_utf8( $options{'body'} )
+ : $options{'body'}
+ ),
'Encoding' => ( $options{'content-type'} ? '-SUGGEST' : '7bit' ),
'Disposition' => 'inline',
};
@mimeargs = (
'Type' => ( $options{'content-type'} || 'text/plain' ),
- 'Data' => $options{'body'},
+ 'Data' => ( $options{'content-type'} =~ /^text\//
+ ? Encode::encode_utf8( $options{'body'} )
+ : $options{'body'}
+ ),
'Encoding' => ( $options{'content-type'} ? '-SUGGEST' : '7bit' ),
);
}
push @to, $options{bcc} if defined($options{bcc});
- # make sure
- my @env_to = split(/\s*,\s*/, join(', ', @to));
- # strip display-name from envelope addresses
- foreach (@env_to) {
- s/^\s*//;
- s/\s*$//;
- s/^(.*)\s*<(.*@.*)>$/$2/;
+ # fully unpack all addresses found in @to (including Bcc) to make the
+ # envelope list
+ my @env_to;
+ foreach my $dest (@to) {
+ push @env_to, map { $_->address } Email::Address->parse($dest);
}
local $@; # just in case
if ( $conf->exists('log_sent_mail') ) {
my $cust_msg = FS::cust_msg->new({
'env_from' => $options{'from'},
- 'env_to' => join(', ', @to),
+ 'env_to' => join(', ', @env_to),
'header' => $message->header_as_string,
'body' => $message->body_as_string,
'_date' => $time,
'Type' => 'text/plain',
'Encoding' => 'quoted-printable',
#'Encoding' => '7bit',
- 'Data' => $data,
+ 'Data' => Encode::encode_utf8($data),
'Disposition' => 'inline',
);
' </title>',
' </head>',
' <body bgcolor="#ffffff">',
- @html_data,
+ ( map Encode::encode_utf8($_), @html_data ),
' </body>',
'</html>',
],
my $papersize = $conf->config('papersize') || 'letter';
+ local($SIG{CHLD}) = sub {};
+
system('dvips', '-q', '-t', $papersize, "$file.dvi", '-o', "$file.ps" ) == 0
or die "dvips failed";
#system('dvipdf', "$file.dvi", "$file.pdf" );
my $papersize = $conf->config('papersize') || 'letter';
+ local($SIG{CHLD}) = sub {};
+
system(
"dvips -q -f $sfile.dvi -t $papersize ".
"| gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=$sfile.pdf ".
: $conf->config('lpr', $opt{'agentnum'} );
my $outerr = '';
+ local($SIG{CHLD}) = sub {};
run3 $lpr, $data, \$outerr, \$outerr;
if ( $? ) {
$outerr = ": $outerr" if length($outerr);
print $fh $logo_data;
close $fh;
+ local($SIG{CHLD}) = sub {};
+
run( [qw(ocroscript recognize), $filename], '>'=>"$filename.hocr" )
or die "ocroscript recognize failed\n";