http://www.perlmonks.org?node_id=328485


in reply to 'Best way to email edited array contents?

I may be overlooking something obvious here, but it looks to me like you never include any attachment/body to %mail. You include to, from, subject and smtp but nothing else.

--Jim

Replies are listed 'Best First'.
Re: Re: 'Best way to email edited array contents?
by Anonymous Monk on Feb 12, 2004 at 19:27 UTC
    Hi Jim.
    Perhaps this is the problem. I tried using the recipe from Oreilly's Perl Cookbook, but still get the same results--an empty email:
    $mailer = Mail::Mailer->new("sendmail"); $mailer->open({ From => $fromaddress, To => $toaddress, Subject => $subject, }) or die "Can't open: $!\n"; print $mailer $body; $mailer->close();

    I apologize in advance for my ignorance, but I am not sure where to put the "print $mailer $body;" and the "$mailer->close();" lines.

    From what I read, I thought I was to put the "$mailer->close();" line at the end of the script, but I'm not sure where to put the "$body" line. I think my problem is most likely not getting a handle on my object.
    Thanks for your help/responses. -Chris

      I guess all I needed was a sprintf command joining the $body with each additional user for which quota data was collected:
      $body = $body . sprintf ("$user\'s disk usage \= %.2f MB.\nHas %.2f MB + available.\nQuota se t to: %.2f MB\n\n", $used, $remainingquota, $limit);</BOLD>

      Now I get the emailed quota data.
      Thanks for the reponses, Chris
        I guess what you say is true, but how could it work before upgrading?