[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl-AnyPerl] sending cgimail from within cgi script



At 14.25 -0400 2000.07.07, Ronald J Kimball wrote:
>On Fri, Jul 07, 2000 at 10:33:34AM -0700, EaTrom wrote:
>
>> What I would like to do is to send a cgimail from a cgi script (not
>> necessarily MacPerl) just before displaying the html page.
>
>
>There are various packages on CPAN for sending mail, which you can find
>here:
>
>http://www.perl.com/CPAN-local/modules/by-category/19_Mail_and_Usenet_News/Mail/
>
>MailTools is the one I've used, I think.

My new favorite for simple mail sending is Mail::Sendmail, which has
nothing to do with the sendmail program.

  use Mail::Sendmail;

  %mail = ( To      => 'you@there.com',
            From    => 'me@here.com',
            Message => "This is a very short message"
           );

  sendmail(%mail) or die $Mail::Sendmail::error;

  print "OK. Log says:\n", $Mail::Sendmail::log;

The smtp host is saved in the module file by default, or you can pass it in
the hash as "smtp => 'smtp.example.com'" or whatever.

-- 
Chris Nandor       |     pudge@pobox.com      |     http://pudge.net/
Andover.Net        | chris.nandor@andover.net | http://slashcode.com/

==== Want to unsubscribe from this list?
==== Send mail with body "unsubscribe" to macperl-anyperl-request@macperl.org