Hi Bruce,

         you asked:

>I am looking for a faster email module than the standard Net::SMTP
>stuff. My script takes so long to run that the caller times out.

How long is "so long" (roughly)? Net::SMTP should be useably quick; the
blockage should only be in establishing the connection to the SMTP server
again and again. But *two* messages shouldn't give any grief whatsoever,
providing the server is correctly called (via Net::Config  in this case).
Impossible to tell without seeing a representative script, but there are
definitely other ways to do what you're after. If you ever need to send a
*lot* of messages it's well worth examining James Thomason's
Mail::Bulkmail, which works fine from MacPerl. In the meantime, here's a
chunk of a message to this list from February this year, with apologies to
those who've already seen it.

[Aside: I searched my "sent mail" but couldn't find the relevant message.
Next idea, which proved far quicker than searching my email archives: search
for [EMAIL PROTECTED] and "sendmail" on google. Brave New World,
(and no wonder the spam keeps rollin' on in...)]

BEGIN_INCLUDE---------

Here are a couple of possibly easier solutions that work fine. Obviously the
InternetConfig call in the first example can be eliminated if you're happy
to hardwire the address.

--------------------------------------------------------------------------

#!perl -w
use strict;
use Mail::Sendmail;
use Mac::InternetConfig;

my %mail = (
    From => $InternetConfig{kICEmail()},  # get sender from IC
    To   => '[EMAIL PROTECTED]',  # recipients go here
    Subject => "MacPerl test message",
);

$mail{Message} = <<EOM;

This is the body of the message!

EOM

sendmail(%mail) or warn $Mail::Sendmail::error;

--------------------------------------------------------------------------

Or if you need to add attachments to messages you can move to MIME::Lite

--------------------------------------------------------------------------

#!perl -w
use MIME::Lite;
$message=MIME::Lite->new(
From=>'[EMAIL PROTECTED]',
To=>'[EMAIL PROTECTED]',
Subject=>'Testing an attachment',
Data=>'Stupid pdf version of mac prices'
);
$message->attach( Type=>'application/pdf',
Encoding=>'base64',
Filename=>'Ass_10.pdf',
Path=>'Macintosh HD:Desktop Folder:Teacher_UniStudent.pdf'
);
MIME::Lite->send('smtp','my.smtp.server',Timeout=>20);
$message->send;

END_INCLUDE---------

Cheers,
         Paul

Reply via email to