},
{
+ 'key' => 'signup_server-email',
+ 'section' => '',
+ 'description' => 'Comma-separated list of email addresses to receive notification of signups via the signup server.',
+ 'type' => 'text',
+ },
+
+
+ {
'key' => 'show-msgcat-codes',
'section' => 'UI',
'description' => 'Show msgcat codes in error messages. Turn this option on before reporting errors to the mailing list.',
#my @print_text = $cust_bill->print_text; #( date )
my @invoicing_list = $self->cust_main->invoicing_list;
if ( grep { $_ ne 'POST' } @invoicing_list ) { #email invoice
- #false laziness w/FS::cust_pay::delete
+ #false laziness w/FS::cust_pay::delete & fs_signup_server
#$ENV{SMTPHOSTS} = $smtpmachine;
$ENV{MAILADDRESS} = $invoice_from;
my $header = new Mail::Header ( [
=head1 VERSION
-$Id: cust_bill.pm,v 1.25 2002-04-06 22:32:43 ivan Exp $
+$Id: cust_bill.pm,v 1.26 2002-04-07 06:23:29 ivan Exp $
=head1 BUGS
if ( $conf->config('deletepayments') ne '' ) {
my $cust_main = qsearchs('cust_main',{ 'custnum' => $self->custnum });
- #false laziness w/FS::cust_bill::send
- $ENV{MAILADDRESS} = $conf->config('invoice_from'); #??? well as good as any
+ #false laziness w/FS::cust_bill::send & fs_signup_server
+ $ENV{MAILADDRESS} = $invoice_from; #??? well as good as any
my $header = new Mail::Header ( [
"From: $invoice_from",
"To: ". $conf->config('deletepayments'),
=head1 VERSION
-$Id: cust_pay.pm,v 1.18 2002-03-18 19:49:10 ivan Exp $
+$Id: cust_pay.pm,v 1.19 2002-04-07 06:23:29 ivan Exp $
=head1 BUGS
#my @payby = qw(CARD PREPAY);
my @payby = $conf->config('signup_server-payby');
+my $smtpmachine = $conf->config('smtpmachine');
my $machine = shift or die &usage;
warn "[fs_signup_server] Sending results...\n" if $Debug;
print $writer $error, "\n";
+ if ( $error && $conf->config('signup_server-email') ) {
+ warn "[fs_signup_server] Sending email...\n" if $Debug;
+
+ #false laziness w/FS::cust_bill::send & FS::cust_pay::delete
+ use Mail::Header;
+ use Mail::Internet;
+ my $from = $conf->config('invoice_from'); #??? as good as any
+ $ENV{MAILADDRESS} = $from;
+ my $header = new Mail::Header ( [
+ "From: $from",
+ "To: ". $conf->config('signup_server-email'),
+ "Sender: $from",
+ "Reply-To: $from",
+ "Date: ". time2str("%a, %d %b %Y %X %z", time),
+ "Subject: FREESIDE NOTIFICATION: Signup Server",
+ ] );
+ my $message = new Mail::Internet (
+ 'Header' => $header,
+ 'Body' => [
+ "This is an automatic message from your Freeside installation\n",
+ "informing you a customer has signed up via the signup server:\n",
+ "\n",
+ 'custnum: '. $cust_main->custnum. "\n",
+ 'Name : '. $cust_main->last. ", ". $cust_main->first. "\n",
+ 'Agent : '. $cust_main->agent->agent. "\n",
+ "\n",
+ ],
+ );
+ $!=0;
+ $message->smtpsend( Host => $smtpmachine )
+ or $message->smtpsend( Host => $smtpmachine, Debug => 1 )
+ or warn "[fs_signup_server] can't send email to ".
+ $conf->config('signup_server-email').
+ " via server $smtpmachine with SMTP: $!";
+ #end-of-send mail
+ }
+
}
close $writer;
close $reader;