I've been using MIME::Lite for a couple of years, now. I'll just use that one. It's quite friendly to work with. I'll give that a try and see what goes.

Thanks again,

Mark


On Apr 25, 2004, at 3:19 PM, Wiggins d'Anconia wrote:


Mark Wheeler wrote:

Thanks. I'll give it a try. That makes sense. When you are talking about mail handling Perl mod, you are talking about NET::SMTP or something like that, right? Also, why would you not want to use mail directly?

Mail is an incredibly complex thing, combine that with trying to handle IPC issues when shelling out, then you are reinventing a wheel that should definitely not be re-invented. Net::SMTP is an example, though probably a more difficult one, there are lots,


http://search.cpan.org/modlist/Mail_and_Usenet_News/Mail

Mail::Mailer
Mail::Sender
MIME::Lite

Are some good choices, I use Mail::Box but generally it is way overkill, but since I know I will have it installed I usually default to it.

Generally using a module will be less error prone, easier to maintain, and more portable.

http://danconia.org

Thanks,
Mark
On Apr 25, 2004, at 2:53 PM, Wiggins d'Anconia wrote:
Mark Wheeler wrote:

Hi,
I just installed 10.3 and am trying to get a cron job to fire off a perl script which will send an email saying the cron job was completed.
crontab listing
* * * * * /Users/blah/Library/Scripts/test.pl
Here is the script:
test.pl
------------------------------------------------
#!/usr/bin/perl -w
use strict;
my $from = '[EMAIL PROTECTED]';
my $to = '[EMAIL PROTECTED]';
my $body = "Success.";
open (SENDMAIL, "| mail -t");


Check that open succeeded, and use a full path to 'mail', especially since under cron your PATH may be different/restricted.

open (SENDMAIL, "| /usr/bin/mail -t") or die "Can't pipe to sendmail: $!";

Having said that, I would suggest not using mail directly at all, instead install a mail handling Perl mod from CPAN, there are lots of them.

print SENDMAIL "Subject: Backup Email Test\n";
print SENDMAIL "From: $from\n";
print SENDMAIL "To: $to\n\n";
print SENDMAIL $body;
close (SENDMAIL);
exit;
--------------------------------------------------
I have enabled Postfix to be running and have sent and received an email from the command line. I've also executed the script run from the command line. But the script doesn't seem to be sending an email. Do I need to get perl set to run in a settings file? I thought that I only needed to mess with settings files if I was going to use the web server. A little help would be appreciated.




Reply via email to