Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

Re: Simplest module for sending email

by Hercynium (Hermit)
on Oct 11, 2007 at 19:34 UTC ( #644312=note: print w/replies, xml ) Need Help??

in reply to Simplest module for sending email

Thanks! I think I've been suffering from CPAN-vertigo. So many modules for email makes this monkey dizzy sometimes.

For the curious, here's what I ended up with:
#!/usr/bin/perl use strict; use warnings; use Net::SMTP; my $mailhost = ''; my $from = ''; my @recipients = split '\s+|,|;', ','; my $subject = 'Regarding your widget purchase'; my $msg =<<"END_MSG"; Hello, Good Sir! Would you like a free cookie with your orange juice? My hovercraft is full of eels! Please remember to wear a sweater when crossing the street. Regards, Mortimer J. Paulinskil END_MSG my $status = eval { my $smtp = Net::SMTP->new($mailhost, Timeout => 10, ); $smtp->mail($from); $smtp->recipient( @recipients, { Notify => ['FAILURE','DELAY'], SkipBad => 1 } ); $smtp->data("Subject: $subject\n\n$msg"); $smtp->quit(); } ? "MESSAGE SENT" : "Error sending message! [ $! ]\n"; print $status;

MIME::Lite would have been great, except that sendmail on that system is seriously broken :(

Thanks again!

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://644312]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (3)
As of 2022-12-03 19:34 GMT
Find Nodes?
    Voting Booth?

    No recent polls found