fix outgoing email with commas in company name, RT#76449
authorIvan Kohler <ivan@freeside.biz>
Fri, 30 Jun 2017 21:23:06 +0000 (14:23 -0700)
committerIvan Kohler <ivan@freeside.biz>
Fri, 30 Jun 2017 21:23:06 +0000 (14:23 -0700)
FS/FS/Conf.pm

index 07042e5..1fe11a0 100644 (file)
@@ -9,6 +9,7 @@ use Carp;
 use IO::File;
 use File::Basename;
 use MIME::Base64;
+use Email::Address;
 use FS::ConfItem;
 use FS::ConfDefaults;
 use FS::Conf_compat17;
@@ -605,10 +606,12 @@ based on their current values.
 
 sub invoice_from_full {
   my ($self, $agentnum) = @_;
-  return $self->config('invoice_from_name', $agentnum ) ?
-         $self->config('invoice_from_name', $agentnum ) . ' <' .
-         $self->config('invoice_from', $agentnum ) . '>' :
-         $self->config('invoice_from', $agentnum );
+
+  my $name =  $self->config('invoice_from_name', $agentnum)
+           || $self->config('company_name', $agentnum);
+
+  Email::Address->new( $name => $self->config('invoice_from', $agentnum ) )
+    ->format;
 }
 
 =back