use vars qw ( @ISA @EXPORT_OK $DEBUG );
use Exporter;
use Carp;
+use Data::Dumper;
@ISA = qw( Exporter );
@EXPORT_OK = qw( send_email send_fax );
sub send_email {
my(%options) = @_;
+ if ( $DEBUG ) {
+ my %doptions = %options;
+ $doptions{'body'} = '(full body not shown in debug)';
+ warn "FS::Misc::send_email called with options:\n ". Dumper(\%doptions);
+# join("\n", map { " $_: ". $options{$_} } keys %options ). "\n"
+ }
$ENV{MAILADDRESS} = $options{'from'};
my $to = ref($options{to}) ? join(', ', @{ $options{to} } ) : $options{to};
}
- $options{'from'} =~ /\@([\w\.\-]+)/ or $1 = 'example.com';
- my $message_id = join('.', rand()*(2**32), $$, time). "\@$1";
+ my $domain;
+ if ( $options{'from'} =~ /\@([\w\.\-]+)/ ) {
+ $domain = $1;
+ } else {
+ warn 'no domain found in invoice from address '. $options{'from'}.
+ '; constructing Message-ID @example.com';
+ $domain = 'example.com';
+ }
+ my $message_id = join('.', rand()*(2**32), $$, time). "\@$domain";
my $message = MIME::Entity->build(
'From' => $options{'from'},
}
package FS::Misc;
+=back
+
=head1 BUGS
This package exists.