in reply to MIME::LITE and Smtp authentication

I havn't tested it, and you havn't showed your code, but you should be able to authenticate once before sending, the do a bunch of sends in a loop. See Autentication problem with MIME::Lite for some code. Just don't send the $smtp->quit until all are sent. Google for "Net::SMTP bulkmail", for some code examples.

Beware your ISP may have limits set on your account to prevent spammers, and you may be violating your terms of agreement if you send too many mails. Better be safe, and ask your ISP's tech support for your limits.


I'm not really a human, but I play one on earth Remember How Lucky You Are

Replies are listed 'Best First'.
Re^2: MIME::LITE and Smtp authentication
by njweatherman (Sexton) on Nov 24, 2008 at 13:25 UTC
    Thank you for taking the time to answer my question. I'm using MIME::LITE to send the email
    MIME::Lite->send('smtp', "$host", AuthUser=>"$user", AuthPass=>"$pass");
    followed by
    $msg->send;

    Correct me if I am wrong, but when $msg->send is called, doesn't that call the $smtp->quit command ?
    If so, how can I avoid that?

      First you will need to show some basic code, and how you want to setup an address loop. MIME::Lite is meant for convenience not flexibility. MIME::Lite integrates easily with Net::SMTP, as the example in the link showed. You might be better off doing a small rewrite, to use the features of Net::SMTP. All you need to do is compose your MIME::Lite message and add as as_string to the Net::SMTP object. Untested pseudo code to show the idea:
      #!/usr/bin/perl use warnings; use strict; use MIME::Lite; use Net::SMTP_auth; #login once my $smtp = Net::SMTP_auth -> new( 'zentara.zentara.net' ); $smtp -> auth( 'LOGIN', 'z', 'ztest' ); ###### put your loop here ######### foreach my $addr ( @addresses){ #compose your message as_string #you can have a very complex MIME::Lite mail here my $msg = MIME::Lite -> new ( From => 'z@zentara.zentara.net', TO => $addr, Subject => 'Testing Text Message', Data => 'How\'s it going.' ); $smtp->mail('z@zentara.zentara.net'); $smtp->to($addr); $smtp -> data(); $smtp -> datasend( $msg->as_string() ); $smtp -> dataend(); } ############################ ## quit when finished loop $smtp -> quit;

      I'm not really a human, but I play one on earth Remember How Lucky You Are