[Chicago-talk] emailing from perl

Mike Fragassi frag at ripco.com
Thu Aug 2 11:04:26 PDT 2007

First, some pointers:

The Perl Email Project Wiki:
Ricardo Signes' talk on the P.E.P. at YAPC 2007:
   (click the "Download" link)

The slides have numerous examples for sending mail, about half-way in.

Finally, can you send plain old email from your host's command line?
    mail -s "test" you at somewhere.com < file

If that works, then if you continue to have problems with mailing 
via Perl, there's a very hacky solution.  Just replace this:

   # Mail HTML document.
   # Params: filename, subject, recipient
   # Returns: none
   sub MailDocument() {

with this:

   sub MailDocument {
      my ($file, $subj, $to) = @_;
      `mail -s $subj $to < $file`;

Just add some parameter testing for validity & taintedness, and 
checking of the output/error from the mail command.

-- Mike F.

More information about the Chicago-talk mailing list