Re: Email Modules
by Rich36 (Chaplain) on May 31, 2002 at 19:30 UTC
|
I like Mail::Mailer - very easy to use and it seems pretty dependable. The drawback is that I don't believe that it's cross platform.
use Mail::Mailer;
my $mailer = Mail::Mailer->new("sendmail");
$mailer->open({From => "$from",
To => "$to",
Subject => "$subject",
})
or die "Can't open: $!\n";
print $mailer $body;
$mailer->close();
Rich36
There's more than one way to screw it up...
| [reply] [d/l] |
|
Thanks for the suggestion, I hadn't heard much about Mail::Mailer before but it looks interesting. I especially like that it allows you to choose which program to send the mail. The 'test' feature described in the docs also looks useful.
As for not being cross platform, it's passed tests on i386-linux, i686-linux, and sun4-solaris so that's not a problem for me. Thanks again :).
| [reply] |
Re: Email Modules
by webfiend (Vicar) on May 31, 2002 at 19:22 UTC
|
Let's see. I've used Mail::Sender and Mail::Sendmail, but not enough to say "one of these is better".
Like you, I've mainly used Mail::Sendmail because of the fact that it's more familiar to me. It worked fine for me in a few mass-mailing tasks involving 3000-4000 emails at a shot... *shudder* the boss told me the list was subscription-only, but I still felt dirty sending out mass mailings...
In other words, I can't tell you how good the alternatives are, but I can say that Mail::Sendmail put up with the most stressful tests I'm ever going to put it through.
"All you need is ignorance and confidence; then success is sure."-- Mark Twain
| [reply] |
Re: Email Modules
by oakbox (Chaplain) on May 31, 2002 at 21:22 UTC
|
I can recommend MIME::Lite if you are going to be sending out multipart messages. It's basic as hell to set up and use in a script. Anytime I need a quick and dirty HTML mailer from within a customer's script, this is what I use.
For more robust applications sending out MIME (a web mailer, for example) I use the MIME::Tools library and build it myself. This is a little more work, but I like the level of control it gives me in constructing the headers and message.
Having said all that, if you are just sending plain text messages, why not just: open (MAIL,"| /usr/sbin/sendmail -t");
print MAIL "To: $to\n";
print MAIL "From: $fromaddr\n";
print MAIL "Subject: $subject\n\n";
print MAIL "$message";
print MAIL "\n.\n";
close(MAIL);
It's basic, it's fast, it's portable, and you don't have to worry about installing a whole module to send a message.
-oakbox
Update : My pipe was broken :)
| [reply] [d/l] |
|
- It's basic, it's fast, it's portable, and you don't have to worry about installing a whole module to send a message.
I strongly disagree with this - This approach is by far not portable as it depends on a number of factors:
- the installation of sendmail on the local machine; this is most certainly not a given, particularly when the script may be run in a Windows environment,
- the installation of the sendmail binary in the /usr/sbin directory; other common locations for this binary include /usr/lib and /opt/bin, and,
- the correct configuration of sendmail for mail delivery in the manner required.
Furthermore, as for the ease of using this approach without installing modules, the Net::SMTP module is included as part of the core Perl installation and as such should be available on all installations. Additionally the use of this module is very straight-forward, for example,
my $smtp = Net::SMTP->new('mail.mydomain.com');
$smtp->mail($fromaddr);
$smtp->to($to);
$smtp->data();
$smtp->data("Subject: $subject\n\n");
$smtp->data($message);
$smtp->dataend();
$smtp->quit;
Furthermore, the use of the local network SMTP server will make your network administrator happier as it is at this point that network mail policies and statistics reporting is often based.
| [reply] [d/l] [select] |
|
| [reply] |
|
| [reply] |
|
I would second that. I had to build a report mail as the user did not want a report file.
Mime made it really easy. If you need to do html mail stuff, you might look at the HTML::FromText as well. It helped on a couple issues.
| [reply] |
|
I'd like to add, that with MIME::Lite you get several important features in one module: extremely easy mail construction, full MIME support and the ability to send the mail right away using your favourite way of sending mails.
| [reply] |
Re: Email Modules
by NaSe77 (Monk) on Jun 03, 2002 at 09:37 UTC
|
i dont want to be kind of heretic but this question is kind of topic in the resent voting on <a href=">http://use.perl.org/pollBooth.pl?section=&qid=13&aid=-1"> use.perl.org ....
there are some more or less usefull answers too
----
NaSe
:x | [reply] |