summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Prykop <jonathan@freeside.biz>2015-01-27 16:25:18 -0600
committerJonathan Prykop <jonathan@freeside.biz>2015-01-27 16:25:18 -0600
commitf13c9d8580d02851b150e21ea9beb6fc1dfbd3c8 (patch)
tree0d3c6ad7f0e7a5dd3068d34fb90f996fc2aadd02
parent412bc43b866761bbdf5db3833960ebe6db1cac18 (diff)
Ticket #30613: Can't Send E-mail
-rw-r--r--FS/FS/Conf.pm17
-rw-r--r--FS/FS/Cron/agent_email.pm5
-rw-r--r--FS/FS/Cron/upload.pm5
-rw-r--r--FS/FS/Misc.pm6
-rw-r--r--FS/FS/Upgrade.pm16
-rw-r--r--FS/FS/cust_bill.pm3
-rw-r--r--FS/FS/cust_credit.pm5
-rw-r--r--FS/FS/cust_main.pm5
-rw-r--r--FS/FS/cust_main/Billing_Realtime.pm5
-rw-r--r--FS/FS/cust_pay.pm5
-rw-r--r--FS/FS/cust_pkg.pm5
-rw-r--r--FS/FS/msg_template.pm6
-rw-r--r--FS/FS/pay_batch.pm5
-rw-r--r--FS/FS/quotation.pm6
-rw-r--r--FS/FS/upload_target.pm5
-rw-r--r--Makefile16
-rw-r--r--httemplate/misc/email-customers.html3
17 files changed, 92 insertions, 26 deletions
diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm
index 39f12c2..279a4df 100644
--- a/FS/FS/Conf.pm
+++ b/FS/FS/Conf.pm
@@ -1233,9 +1233,24 @@ sub reason_type_options {
{
'key' => 'invoice_from',
'section' => 'required',
- 'description' => 'Return address on email invoices',
+ 'description' => 'Return address on email invoices (address only, see invoice_from_name)',
'type' => 'text',
'per_agent' => 1,
+ 'validate' => sub { $_[0] =~
+ /^[^@]+\@[[:alnum:]-]+(\.[[:alnum:]-]+)+$/
+ ? '' : 'Invalid email address';
+ }
+ },
+
+ {
+ 'key' => 'invoice_from_name',
+ 'section' => 'invoicing',
+ 'description' => 'Return name on email invoices (set address in invoice_from)',
+ 'type' => 'text',
+ 'per_agent' => 1,
+ 'validate' => sub { (($_[0] =~ /[^[:alnum:][:space:]]/) && ($_[0] !~ /^\".*\"$/))
+ ? 'Invalid name. Use quotation marks around names that contain punctuation.'
+ : '' }
},
{
diff --git a/FS/FS/Cron/agent_email.pm b/FS/FS/Cron/agent_email.pm
index 992aa35..623b920 100644
--- a/FS/FS/Cron/agent_email.pm
+++ b/FS/FS/Cron/agent_email.pm
@@ -29,7 +29,10 @@ sub agent_email {
RT::ConnectToDatabase();
}
- my $from = $conf->config('invoice_from');
+ my $from = $conf->config('invoice_from_name') ?
+ $conf->config('invoice_from_name') . ' <' .
+ $conf->config('invoice_from') . '>' :
+ $conf->config('invoice_from');
my $outbuf = '';;
my( $fs_interp, $rt_interp ) = mason_interps('standalone', 'outbuf'=>\$outbuf);
diff --git a/FS/FS/Cron/upload.pm b/FS/FS/Cron/upload.pm
index 03ed366..fa1762f 100644
--- a/FS/FS/Cron/upload.pm
+++ b/FS/FS/Cron/upload.pm
@@ -508,7 +508,10 @@ sub prepare_report {
(
to => $to,
- from => $conf->config('invoice_from', $agentnum),
+ from => $conf->config('invoice_from_name', $agentnum) ?
+ $conf->config('invoice_from_name', $agentnum) . ' <' .
+ $conf->config('invoice_from', $agentnum) . '>' :
+ $conf->config('invoice_from', $agentnum),
subject => $subject,
body => $body,
);
diff --git a/FS/FS/Misc.pm b/FS/FS/Misc.pm
index f597058..036c32d 100644
--- a/FS/FS/Misc.pm
+++ b/FS/FS/Misc.pm
@@ -255,9 +255,9 @@ sub send_email {
push @to, $options{bcc} if defined($options{bcc});
local $@; # just in case
- eval { sendmail($message, { transport => $transport,
- from => $from,
- to => \@to }) };
+# eval { sendmail($message, { transport => $transport,
+# from => $from,
+# to => \@to }) };
my $error = '';
if(ref($@) and $@->isa('Email::Sender::Failure')) {
diff --git a/FS/FS/Upgrade.pm b/FS/FS/Upgrade.pm
index 381fd5f..5d092ed 100644
--- a/FS/FS/Upgrade.pm
+++ b/FS/FS/Upgrade.pm
@@ -46,6 +46,22 @@ sub upgrade_config {
my $conf = new FS::Conf;
+ if ($conf->config('invoice_from') =~ /\<(.*)\>/) {
+ my $realemail = $1;
+ $realemail =~ s/^\s*//; # remove leading spaces
+ $realemail =~ s/\s*$//; # remove trailing spaces
+ my $realname = $conf->config('invoice_from');
+ $realname =~ s/\<.*\>//; # remove email address
+ $realname =~ s/^\s*//; # remove leading spaces
+ $realname =~ s/\s*$//; # remove trailing spaces
+ # properly quote names that contain punctuation
+ if (($realname =~ /[^[:alnum:][:space:]]/) && ($realname !~ /^\".*\"$/)) {
+ $realname = '"' . $realname . '"';
+ }
+ $conf->set('invoice_from_name', $realname);
+ $conf->set('invoice_from', $realemail);
+ }
+
$conf->touch('payment_receipt')
if $conf->exists('payment_receipt_email')
|| $conf->config('payment_receipt_msgnum');
diff --git a/FS/FS/cust_bill.pm b/FS/FS/cust_bill.pm
index bcfbbc7..6ded57f 100644
--- a/FS/FS/cust_bill.pm
+++ b/FS/FS/cust_bill.pm
@@ -1085,6 +1085,9 @@ sub email {
# this is where we set the From: address
$from ||= $self->_agent_invoice_from || #XXX should go away
+ $conf->config('invoice_from_name', $self->cust_main->agentnum ) ?
+ $conf->config('invoice_from_name', $self->cust_main->agentnum ) . ' <' .
+ $conf->config('invoice_from', $self->cust_main->agentnum ) . '>' :
$conf->config('invoice_from', $self->cust_main->agentnum );
my @invoicing_list = $self->cust_main->invoicing_list_emailonly;
diff --git a/FS/FS/cust_credit.pm b/FS/FS/cust_credit.pm
index df2a6cc..6f4f720 100644
--- a/FS/FS/cust_credit.pm
+++ b/FS/FS/cust_credit.pm
@@ -282,7 +282,10 @@ sub delete {
my $cust_main = $self->cust_main;
my $error = send_email(
- 'from' => $conf->config('invoice_from', $self->cust_main->agentnum),
+ 'from' => $conf->config('invoice_from_name', $self->cust_main->agentnum) ?
+ $conf->config('invoice_from_name', $self->cust_main->agentnum) . ' <' .
+ $conf->config('invoice_from', $self->cust_main->agentnum) . '>' :
+ $conf->config('invoice_from', $self->cust_main->agentnum),
#invoice_from??? well as good as any
'to' => $conf->config('deletecredits'),
'subject' => 'FREESIDE NOTIFICATION: Credit deleted',
diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm
index 9f95620..e4766f5 100644
--- a/FS/FS/cust_main.pm
+++ b/FS/FS/cust_main.pm
@@ -4327,7 +4327,10 @@ sub notify {
return unless $conf->exists($template);
- my $from = $conf->config('invoice_from', $self->agentnum)
+ my $from = $conf->config('invoice_from_name', $self->agentnum) ?
+ $conf->config('invoice_from_name', $self->agentnum) . ' <' .
+ $conf->config('invoice_from', $self->agentnum) . '>' :
+ $conf->config('invoice_from', $self->agentnum)
if $conf->exists('invoice_from', $self->agentnum);
$from = $options{from} if exists($options{from});
diff --git a/FS/FS/cust_main/Billing_Realtime.pm b/FS/FS/cust_main/Billing_Realtime.pm
index 330a454..f9f3754 100644
--- a/FS/FS/cust_main/Billing_Realtime.pm
+++ b/FS/FS/cust_main/Billing_Realtime.pm
@@ -1109,7 +1109,10 @@ sub _realtime_bop_result {
};
my $error = send_email(
- 'from' => $conf->config('invoice_from', $self->agentnum ),
+ 'from' => $conf->config('invoice_from_name', $self->agentnum ) ?
+ $conf->config('invoice_from_name', $self->agentnum ) . ' <' .
+ $conf->config('invoice_from', $self->agentnum ) . '>' :
+ $conf->config('invoice_from', $self->agentnum ),
'to' => [ grep { $_ ne 'POST' } $self->invoicing_list ],
'subject' => 'Your payment could not be processed',
'body' => [ $template->fill_in(HASH => $templ_hash) ],
diff --git a/FS/FS/cust_pay.pm b/FS/FS/cust_pay.pm
index 87fad02..0020a82 100644
--- a/FS/FS/cust_pay.pm
+++ b/FS/FS/cust_pay.pm
@@ -694,7 +694,10 @@ sub send_receipt {
'msgtype' => 'receipt',
};
$error = $queue->insert(
- 'from' => $conf->config('invoice_from', $cust_main->agentnum),
+ 'from' => $conf->config('invoice_from_name', $cust_main->agentnum ) ?
+ $conf->config('invoice_from_name', $cust_main->agentnum ) . ' <' .
+ $conf->config('invoice_from', $cust_main->agentnum ) . '>' :
+ $conf->config('invoice_from', $cust_main->agentnum ),
#invoice_from??? well as good as any
'to' => \@invoicing_list,
'subject' => 'Payment receipt',
diff --git a/FS/FS/cust_pkg.pm b/FS/FS/cust_pkg.pm
index 5c82ad2..ccf63db 100644
--- a/FS/FS/cust_pkg.pm
+++ b/FS/FS/cust_pkg.pm
@@ -947,7 +947,10 @@ sub cancel {
}
else {
$error = send_email(
- 'from' => $conf->config('invoice_from', $self->cust_main->agentnum),
+ 'from' => $conf->config('invoice_from_name', $self->cust_main->agentnum) ?
+ $conf->config('invoice_from_name', $self->cust_main->agentnum) . ' <' .
+ $conf->config('invoice_from', $self->cust_main->agentnum) . '>' :
+ $conf->config('invoice_from', $self->cust_main->agentnum),
'to' => \@invoicing_list,
'subject' => ( $conf->config('cancelsubject') || 'Cancellation Notice' ),
'body' => [ map "$_\n", $conf->config('cancelmessage') ],
diff --git a/FS/FS/msg_template.pm b/FS/FS/msg_template.pm
index 65890e1..70a8e49 100644
--- a/FS/FS/msg_template.pm
+++ b/FS/FS/msg_template.pm
@@ -398,8 +398,10 @@ sub prepare {
$from_addr = scalar( $conf->config($opt{'from_config'},
$cust_main->agentnum) );
}
- $from_addr ||= scalar( $conf->config('invoice_from',
- $cust_main->agentnum) );
+ $from_addr ||= $conf->config('invoice_from_name', $cust_main->agentnum) ?
+ $conf->config('invoice_from_name', $cust_main->agentnum) . ' <' .
+ $conf->config('invoice_from', $cust_main->agentnum) . '>' :
+ $conf->config('invoice_from', $cust_main->agentnum);
}
# my @cust_msg = ();
# if ( $conf->exists('log_sent_mail') and !$opt{'preview'} ) {
diff --git a/FS/FS/pay_batch.pm b/FS/FS/pay_batch.pm
index b6b69f3..3079db1 100644
--- a/FS/FS/pay_batch.pm
+++ b/FS/FS/pay_batch.pm
@@ -749,7 +749,10 @@ sub import_from_gateway {
my $body = "Import from gateway ".$gateway->label."\n".$error_text;
send_email(
to => $mail_on_error,
- from => $conf->config('invoice_from'),
+ from => $conf->config('invoice_from_name') ?
+ $conf->config('invoice_from_name') . ' <' .
+ $conf->config('invoice_from') . '>' :
+ $conf->config('invoice_from'),
subject => $subject,
body => $body,
);
diff --git a/FS/FS/quotation.pm b/FS/FS/quotation.pm
index 75a592d..774495a 100644
--- a/FS/FS/quotation.pm
+++ b/FS/FS/quotation.pm
@@ -183,8 +183,10 @@ sub email {
# this is where we set the From: address
$from ||= $conf->config('quotation_from', $self->cust_or_prospect->agentnum )
- || $conf->config('invoice_from', $self->cust_or_prospect->agentnum );
-
+ || ($conf->config('invoice_from_name', $self->cust_or_prospect->agentnum ) ?
+ $conf->config('invoice_from_name', $self->cust_or_prospect->agentnum ) . ' <' .
+ $conf->config('invoice_from', $self->cust_or_prospect->agentnum ) . '>' :
+ $conf->config('invoice_from', $self->cust_or_prospect->agentnum ));
$self->SUPER::email( {
'from' => $from,
%$opt,
diff --git a/FS/FS/upload_target.pm b/FS/FS/upload_target.pm
index 33088cb..73d2a04 100644
--- a/FS/FS/upload_target.pm
+++ b/FS/FS/upload_target.pm
@@ -163,7 +163,10 @@ sub put {
# (maybe use only the raw content, so that we don't have to supply a
# customer for substitutions? ewww.)
my %message = (
- 'from' => $conf->config('invoice_from'),
+ 'from' => $conf->config('invoice_from_name') ?
+ $conf->config('invoice_from_name') . ' <' .
+ $conf->config('invoice_from') . '>' :
+ $conf->config('invoice_from'),
'to' => $to,
'subject' => $self->subject,
'nobody' => 1,
diff --git a/Makefile b/Makefile
index 67bf83c..b3b556c 100644
--- a/Makefile
+++ b/Makefile
@@ -7,7 +7,7 @@ DB_TYPE = Pg
#DB_TYPE = mysql
DB_USER = freeside
-DB_PASSWORD=
+DB_PASSWORD=hRoVj902
DATASOURCE = DBI:${DB_TYPE}:dbname=freeside
@@ -27,9 +27,9 @@ MASONDATA = ${FREESIDE_CACHE}/masondata
DIST_CONF = ${FREESIDE_CONF}/default_conf
#mod_perl v2 1.999_22 on Apache 2.0 through 2.3 (Debian ancient through 7.x)
-#APACHE_VERSION=2
+APACHE_VERSION=2
#Apache 2.4 (Debian 8.x)
-APACHE_VERSION=2.4
+#APACHE_VERSION=2.4
#deb
FREESIDE_DOCUMENT_ROOT = /var/www/freeside
@@ -71,9 +71,9 @@ HTTPD_RESTART = /etc/init.d/apache2 restart
#(an include directory, not a file, "Include /etc/apache/conf.d" in httpd.conf)
#debian unstable/8.0+, apache2.4
-APACHE_CONF = /etc/apache2/conf-available
+#APACHE_CONF = /etc/apache2/conf-available
#deb (3.1+), apache2
-#APACHE_CONF = /etc/apache2/conf.d
+APACHE_CONF = /etc/apache2/conf.d
INSSERV_OVERRIDE = /etc/insserv/overrides
@@ -103,10 +103,10 @@ SELFSERVICE_INSTALL_USERADD = /usr/sbin/useradd
#RT_ENABLED = 0
RT_ENABLED = 1
-RT_DOMAIN = example.com
-RT_TIMEZONE = US/Pacific
+RT_DOMAIN = localhost
+RT_TIMEZONE = US/Central
#RT_TIMEZONE = US/Eastern
-FREESIDE_URL = "http://192.168.1.6/freeside/"
+FREESIDE_URL = "http://localhost/freeside/"
#for now, same db as specified in DATASOURCE... eventually, otherwise?
RT_DB_DATABASE = freeside
diff --git a/httemplate/misc/email-customers.html b/httemplate/misc/email-customers.html
index 1592630..c74c15b 100644
--- a/httemplate/misc/email-customers.html
+++ b/httemplate/misc/email-customers.html
@@ -103,7 +103,8 @@ Template:
<& /elements/tr-td-label.html, 'label' => 'From:' &>
<TD><& /elements/input-text.html,
'field' => 'from_name',
- 'value' => $conf->config('company_name', $agent_virt_agentnum), #?
+ 'value' => $conf->config('invoice_from_name', $agent_virt_agentnum) ||
+ $conf->config('company_name', $agent_virt_agentnum), #?
'size' => 20,
&>&nbsp;&lt;\
<& /elements/input-text.html,