diff options
author | Mark Wells <mark@freeside.biz> | 2013-05-20 12:36:06 -0700 |
---|---|---|
committer | Mark Wells <mark@freeside.biz> | 2013-05-20 12:36:06 -0700 |
commit | eef99d4b1595d23b73f8800900ba984fe242b8c4 (patch) | |
tree | a4f38fa6f8b24b8e53f45a96c6a9e14ca3e446ff /FS | |
parent | 508756cf10352b6cf54a32fbce18ec57121214ce (diff) |
allow friendly from: addresses on email notices, #22962
Diffstat (limited to 'FS')
-rw-r--r-- | FS/FS/Misc.pm | 11 | ||||
-rw-r--r-- | FS/FS/UI/Web.pm | 4 | ||||
-rw-r--r-- | FS/FS/cust_main_Mixin.pm | 1 |
3 files changed, 14 insertions, 2 deletions
diff --git a/FS/FS/Misc.pm b/FS/FS/Misc.pm index dbebf33b8..9c18961ea 100644 --- a/FS/FS/Misc.pm +++ b/FS/FS/Misc.pm @@ -171,8 +171,15 @@ sub send_email { } + my $from = $options{from}; + $from =~ s/^\s*//; $from =~ s/\s*$//; + if ( $from =~ /^(.*)\s*<(.*@.*)>$/ ) { + # a common idiom + $from = $2; + } + my $domain; - if ( $options{'from'} =~ /\@([\w\.\-]+)/ ) { + if ( $from =~ /\@([\w\.\-]+)/ ) { $domain = $1; } else { warn 'no domain found in invoice from address '. $options{'from'}. @@ -247,7 +254,7 @@ sub send_email { push @to, $options{bcc} if defined($options{bcc}); local $@; # just in case eval { sendmail($message, { transport => $transport, - from => $options{from}, + from => $from, to => \@to }) }; my $error = ''; diff --git a/FS/FS/UI/Web.pm b/FS/FS/UI/Web.pm index f63854ca0..ccba1de3a 100644 --- a/FS/FS/UI/Web.pm +++ b/FS/FS/UI/Web.pm @@ -678,6 +678,10 @@ sub start_job { #warn 'froze string of size '. length(nfreeze(\%param)). " for job args\n" # if $DEBUG; + # + # XXX FS::queue::insert knows how to do this. + # not changing it here because that requires changing it everywhere else, + # too, but we should eventually fix it my $error = $job->insert( '_JOB', encode_base64(nfreeze(\%param)) ); diff --git a/FS/FS/cust_main_Mixin.pm b/FS/FS/cust_main_Mixin.pm index a0677060e..212c04e0f 100644 --- a/FS/FS/cust_main_Mixin.pm +++ b/FS/FS/cust_main_Mixin.pm @@ -539,6 +539,7 @@ sub process_email_search_result { die "error loading FS::$table: $@\n" if $@; my $error = "FS::$table"->email_search_result( $param ); + dbh->commit; # save failed jobs before rethrowing the error die $error if $error; } |