Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Simplest module for sending email

by Hercynium (Hermit)
on Oct 11, 2007 at 19:34 UTC ( [id://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 = 'smtp.mydomain.com'; my $from = 'me@mydomain.com'; my @recipients = split '\s+|,|;', 'joe@domain.com,larry@otherdomain.com'; 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?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (5)
As of 2024-04-19 03:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found