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

Re: [MacPerl] sending email through Perl




Thanks Chris Nador for suggesting Mail::Send.

Below my sig is a sample script using Mail::Send to send emails, but it's
fairly complex in comparison of just calling "qx" and "mail" (on unix systems).

How'd one use Mail::Send to send dozens of emails? It'd be a pain
if it's necessary to create dozens of objects and filehandles.

 Xah, xah@best.com
 http://www.best.com/~xah/PageTwo_dir/more.html
 Mountain View, CA, USA

#----

#!/usr/local/bin/perl5 -w
use strict;
use lib qw(/users/u1/xah/site_perl/MailTools-1.12);
use Mail::Send;

#--------------------
my $bodyText = <<'hereDoc28';
testing testing
this message is send my a perl script
hereDoc28

# qx{echo "$bodyText" | mail -s subjectLine xah\@best.com};

my $msg = new Mail::Send;
$msg->to('xah@best.com');
$msg->subject('subjectLine');
my $fh = $msg->open;
print $fh "$bodyText";
$fh->close;

__END__

Chris Nandor writes:
 > At 15.04 -0500 1998.11.14, Xah Lee wrote:
 > >But what's a portable way of sending email in Perl?
 > 
 > See the MailTools distribution on CPAN.  Graham Barr wrote it.  Previously,
 > you had to use Net::SMTP directly to do portable mail, but now Mail::Send
 > and friends use Net::SMTP for you if sendmail, etc. are not available.

***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch