Re: Trap MX-server responses
"Jan Stapel/Vito & Associates, Inc" <[email protected]>
| Newsgroups | gmane.comp.lang.perl.modules.mail-box |
|---|---|
| Message-ID | <[email protected]> |
I have modified my script as follows:
$msg = MIME::Entity->build(Type => "multipart/alternative",
From => $frommail,
To => $email,
"Reply-To" =>
$replymail,
Subject => $subject);
$msg->attach(Data => $tmessage,
Type => "text/plain",
Encoding => "quoted-printable");
$msg->attach(Data => $message,
Type => "text/html",
Encoding => "quoted-printable");
$sender = Mail::Transport->new(hostname => '10.0.0.61', via => 'SMTP', helo
=>'vitoassoc.com');
my ($success, $errorcode, $errortext, $errorlocation, $quitsuccess)
= $sender->trySend($msg);
#$sender->send($msg);
print $success;
print $errorcode;
print $errortext;
print $errorlocation;
print $quitsuccess;
print "endcodes\n"
}
I get this error:
Can't locate auto/MIME/Entity/sender.al in @INC (@INC contains:
/usr/local/lib/p
erl5/5.6.1/i586-linux /usr/local/lib/perl5/5.6.1
/usr/local/lib/perl5/site_perl/
5.6.1/i586-linux /usr/local/lib/perl5/site_perl/5.6.1
/usr/local/lib/perl5/site_
perl .) at /usr/local/lib/perl5/site_perl/5.6.1/Mail/Transport/SMTP.pm line 47
I am running :
Mail-Box-2.053
MIME-tools-5.411a
Thank you.
At 09:46 AM 3/12/2004 +0100, Mark Overmeer wrote:
>* Jan Stapel/Vito & Associates, Inc ([email protected]) [040312 04:00]:
>
> > $sender = Mail::Transport->new(hostname => '10.0.0.61', port => '25', via
> > => 'SMTP', helo =>'vitoassoc.com',
> > smtp_debug => 'true');
>
>That may be possible, but certainly not the way I would like people
>to use MailBox. The interface I designed would be either:
>
> $msg->send(via => 'SMTP'); # creates a Mail::Transport::SMTP each time
>
>or
>
> my $smtp = Mail::Transport::SMTP->new;
> $smtp->send($msg);
>
> > As I understand Net::SMTP is used by Mail::Transport......via =>'SMTP'.
>
>Correct
>
> > Below is a small script using Net::SMTP, where it looks for "550" return
> > codes to flag bad email address.
> > $smtp->mail('[email protected]');
> > $smtp->recipient('[email protected]');
> > if ($smtp->code() eq "550")
> > {
> > $smtp->reset();
> > $smtp->quit;
> >
> > How can I incorporate this same idea in Mail::Transport?
>
>$smtp->send($msg) makes repeated calles to to try_send, in this case
>Mail::Transport::SMTP::try_send(). If you want to have more control
>over the process, you can use trySend directly:
>
> my $smtp = Mail::Transport::SMTP->new;
> if($smtp->trySend(...)) .... success
>
>However... when you call it in LIST context, you will also see the
>error codes:
>
> my ($success, $errorcode, $errortext, $errorlocation, $quitsuccess)
> = $smtp->trySend(...);
>
> if( $errocode==550)
> ...
>
>So: the whole Net::SMTP thing is hidden.
>--
> MarkOv
>
>------------------------------------------------------------------------
>drs Mark A.C.J. Overmeer MARKOV Solutions
> [email protected] [email protected]
>http://Mark.Overmeer.net http://solutions.overmeer.net
Jan Stapel
Vito & Associates, Inc.
Automation Consultants
"We Keep People & Their Data Connected"
Phone: 760-318-1328
Cellular Phone: 818-266-0976
www.vitoassoc.com
www.vitoassoc.net
www.mailherd.com