1 package SL::Mailer::Sendmail;
9 use parent qw(Rose::Object);
11 use Rose::Object::MakeMethods::Generic
13 scalar => [ qw(myconfig mailer form status extended_status) ]
22 extended_status => 'no send attempt made',
25 my $email = Encode::encode('utf-8', $self->myconfig->{email});
26 $email =~ s/[^\w\.\-\+=@]//ig;
28 my %temp_form = ( %{ $self->form }, myconfig_email => $email );
29 my $template = SL::Template::create(type => 'ShellCommand', form => \%temp_form);
30 my $sendmail = $::lx_office_conf{applications}->{sendmail} || $::lx_office_conf{mail_delivery}->{sendmail} || "sendmail -t";
31 $sendmail = $template->parse_block($sendmail);
33 $self->{sendmail} = IO::File->new("|$sendmail") or do { $self->extended_status("sendmail($sendmail): $!"); die $self->extended_status; };
34 $self->{sendmail}->binmode(':utf8');
43 $self->{sendmail}->print(@_) or do { $self->extended_status("sendmail: $!"); die $self->extended_status; };
49 $self->{sendmail}->close or do { $self->extended_status("sendmail: $!"); die $self->extended_status; };
52 $self->extended_status('');
54 delete $self->{sendmail};
57 sub keep_from_header {