projects
/
kivitendo-erp.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
spellcheck.t um lenght erweitert
[kivitendo-erp.git]
/
SL
/
Mailer
/
Sendmail.pm
diff --git
a/SL/Mailer/Sendmail.pm
b/SL/Mailer/Sendmail.pm
index
6b24ecd
..
59c43cd
100644
(file)
--- a/
SL/Mailer/Sendmail.pm
+++ b/
SL/Mailer/Sendmail.pm
@@
-2,6
+2,7
@@
package SL::Mailer::Sendmail;
use strict;
use strict;
+use Encode;
use IO::File;
use SL::Template;
use IO::File;
use SL::Template;
@@
-9,15
+10,19
@@
use parent qw(Rose::Object);
use Rose::Object::MakeMethods::Generic
(
use Rose::Object::MakeMethods::Generic
(
- scalar => [ qw(myconfig mailer form) ]
+ scalar => [ qw(myconfig mailer form
status extended_status
) ]
);
sub init {
my ($self) = @_;
);
sub init {
my ($self) = @_;
- Rose::Object::init(@_);
+ Rose::Object::init(
+ @_,
+ status => 'failed',
+ extended_status => 'no send attempt made',
+ );
- my $email =
$self->mailer->recode(
$self->myconfig->{email});
+ my $email =
Encode::encode('utf-8',
$self->myconfig->{email});
$email =~ s/[^\w\.\-\+=@]//ig;
my %temp_form = ( %{ $self->form }, myconfig_email => $email );
$email =~ s/[^\w\.\-\+=@]//ig;
my %temp_form = ( %{ $self->form }, myconfig_email => $email );
@@
-25,7
+30,8
@@
sub init {
my $sendmail = $::lx_office_conf{applications}->{sendmail} || $::lx_office_conf{mail_delivery}->{sendmail} || "sendmail -t";
$sendmail = $template->parse_block($sendmail);
my $sendmail = $::lx_office_conf{applications}->{sendmail} || $::lx_office_conf{mail_delivery}->{sendmail} || "sendmail -t";
$sendmail = $template->parse_block($sendmail);
- $self->{sendmail} = IO::File->new("|$sendmail") || die "sendmail($sendmail): $!";
+ $self->{sendmail} = IO::File->new("|$sendmail") or do { $self->extended_status("sendmail($sendmail): $!"); die $self->extended_status; };
+ $self->{sendmail}->binmode(':utf8');
}
sub start_mail {
}
sub start_mail {
@@
-34,12
+40,17
@@
sub start_mail {
sub print {
my $self = shift;
sub print {
my $self = shift;
- $self->{sendmail}->print(@_);
+ $self->{sendmail}->print(@_)
or do { $self->extended_status("sendmail: $!"); die $self->extended_status; }
;
}
sub send {
my ($self) = @_;
}
sub send {
my ($self) = @_;
- $self->{sendmail}->close;
+
+ $self->{sendmail}->close or do { $self->extended_status("sendmail: $!"); die $self->extended_status; };
+
+ $self->status('ok');
+ $self->extended_status('');
+
delete $self->{sendmail};
}
delete $self->{sendmail};
}