$main::lxdebug->enter_sub();
my ($self, $myconfig, $userspath) = @_;
- my $template;
+ my ($template, $out);
+
+ local (*IN, *OUT);
$self->{"cwd"} = getcwd();
$self->{"tmpdir"} = $self->{cwd} . "/${userspath}";
# for postscript we store a copy in a temporary file
my $fileid = time;
$self->{tmpfile} ||= "$userspath/${fileid}.$self->{IN}";
+
if ($template->uses_temp_file() || $self->{media} eq 'email') {
$out = $self->{OUT};
$self->{OUT} = ">$self->{tmpfile}";
}
- my $err = $mail->send($out);
+ my $err = $mail->send();
$self->error($self->cleanup . "$err") if ($err);
} else {
sub send {
$main::lxdebug->enter_sub();
- my ($self, $out) = @_;
+ my ($self) = @_;
+
+ local (*IN, *OUT);
my $boundary = time;
$boundary = "LxOffice-$self->{version}-$boundary";
$self->{charset} = Common::DEFAULT_CHARSET unless $self->{charset};
- if ($out) {
- if (!open(OUT, $out)) {
- $main::lxdebug->leave_sub();
- return "$out : $!";
- }
- } else {
- if (!open(OUT, ">-")) {
- $main::lxdebug->leave_sub();
- return "STDOUT : $!";
- }
+ if (!open(OUT, $main::sendmail)) {
+ $main::lxdebug->leave_sub();
+ return "$main::sendmail : $!";
}
$self->{contenttype} = "text/plain" unless $self->{contenttype};
$form->{subject} = qq|$form->{label} $form->{"${inv}number"}|
unless $form->{subject};
- $form->{OUT} = "$sendmail";
-
$form->{emailed} .= " $form->{formname}";
$form->{emailed} =~ s/^ //;
}