[Perl] Sending emails

Oleg Kobets gwizard at clean-mail.net
Sun Nov 10 06:53:26 PST 2002


use Mail::Mailer;

my $from_address = "<FROM>\@<HOST>";
my $to_address = "<TO>\@<HOST>";
my $subject = "Subject!";

$mailer = Mail::Mailer->new();
$mailer->open({ From    => $from_address,
                To      => $to_address,
                Subject => $subject,
         or die "Can't open: $!\n";
print $mailer <YOUR MESSAGE GOES HERE>;

Oleg Kobets
Network Administrator
Breakthrough LTD.
03-6349922 Ext 26

"Black hole is God divided by zero"
----- Original Message ----- 
From: "Reuven M. Lerner" <reuven at lerner.co.il>
To: <perl at perl.org.il>
Cc: "Reuven M. Lerner" <reuven at lerner.co.il>
Sent: Sunday, November 10, 2002 4:45 PM
Subject: [Perl] Sending emails

> >>>>> "Shlomo" == Shlomo Yona <shlomo at cs.haifa.ac.il> writes:
>     Shlomo> I wonder if experienced users can suggest a preferable way
>     Shlomo> of sending mail from Perl scripts.
> I generally use Mail::Sendmail, available on CPAN.  I'm not sure how
> efficient it is, but the API is ridiculously simple.
>     Shlomo> I need to be able to specify sender, recipient,
>     Shlomo> attachments, and of course message body and a subject.
> If you want to send attachments, then you might want to look into
> Mail::Sender.  This seems to be the module that many people use to
> send attachments and other complex documents.  Unfortunately, I've
> found the documentation for Mail::Sender to be very hard to
> understand.  In particular, the code samples are written in a very
> weird syntax.
> But hey, it's still better than invoking the command-line "mail"
> program via system()...
> Reuven
> _______________________________________________
> Perl mailing list
> Perl at perl.org.il
> http://www.perl.org.il/cgi/listinfo/perl

More information about the Perl mailing list