Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add body text for body data.
  • Loading branch information
davorg committed Feb 3, 2016
1 parent e9f73c1 commit def406e
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions email_snds_data
Expand Up @@ -22,15 +22,19 @@ my $ua = LWP::UserAgent->new;
my $email = Email::Stuffer->new
->to($to)
->subject('SDNS Data')
->from('postmaster@mag-sol.com')
->text_body('Here is your SNDS data');
->from('postmaster@mag-sol.com');

my $body = 'Here is your SNDS data';

foreach (@urls) {
if (my $file = get_url($ua, $_, $key)) {
$email->attach_file($file);
} else {
$body .= "\n\nNo data from $_.";
}
}

$email->text_body($body);
$email->send_or_die;

sub get_url {
Expand All @@ -39,7 +43,7 @@ sub get_url {
my $resp = $ua->get("$url?key=$key");
my $data = $resp->content;
unless (length $data) {
warn "No data for $url\n";
warn "No data from $url\n";
return;
}

Expand Down

0 comments on commit def406e

Please sign in to comment.