diff options
-rw-r--r-- | LedgerSMB/Mailer.pm | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/LedgerSMB/Mailer.pm b/LedgerSMB/Mailer.pm index 6ff22c62..a650d4e1 100644 --- a/LedgerSMB/Mailer.pm +++ b/LedgerSMB/Mailer.pm @@ -125,10 +125,14 @@ sub attach { carp "Message not prepared" unless ref $self->{_message}; # strip path from output name - my $file = $args{filename}; - my $strip = quotemeta $args{strip}; - $file =~ s/(.*\/|$strip)//g; - + my $file; + if ($args{filename}) { + my $strip = quotemeta $args{strip}; + $file = $args{filename}; + $file =~ s/(.*\/|$strip)//g; + } + + # handle both string and file types of input my @data; if ($args{data}) { @data = ('Data', $args{data}); |