in reply to Module for smtp mail server?

Here is all soubroutines which I write to my script.
use Net::SMTP; $from = "SMSrobot"; $to = "me\@mydomai.com"; $smtp_retry = "3"; $smtp_timeout = "60"; $smtp_server = "smtp.provider.com"; # -------------------------------------------------------------------- +----- #sub smtp sub smtp { my ( $message ) = @_[0]; &logging("Conecting to $smtp_server SMTP server..."); unless ( $smtp = Net::SMTP->new( $smtp_server, Hello => $from, Tim +eout => $smtp_timeout ) ) { &logging("Can't connect."); return 0; } &logging("Conected."); unless ( $smtp->mail( $from ) and $smtp->to( $to ) ) { &logging("Can't initialize communication"); return 0; } &logging("Sending mail to $to"); unless ( $smtp->data() and $smtp->datasend("$message\n") and $smtp +->dataend() and $smtp->quit) { &logging("Can't send data."); return 0; } $message =~ s/\s/ /isg; &logging("Message: \"$message\" was sent."); &logging("Quit."); return 1; }
Just call this by &smtp('mail message');

Replies are listed 'Best First'.
Re: Re: Module for smtp mail server?
by Anonymous Monk on Mar 16, 2001 at 22:50 UTC
    I have used Mail::Sendmail for a long time now to handle emailing of sorts. Ultra simple:
    use Mail::Sendmail; my %message = (To => "some address", From => "your address", Subject => "subject", Message => "text"); sendmail(%message) or die $Mail::Sendmail::error;
    That's it. Set up your smtp server(s) in Sendmail.pm in %mailcfg at the top.