Hi there
You need to perform a 'helo' instead:-
try {
$test->connect();
$test->helo();
$test->disconnect();
} catch (Zend_Mail_Protocol_Exception $e) {
...handle incorrect auth details...
}
This is because 'auth()' expects that the smtp server has
already
received the helo sequence, and secondly because the 'helo'
method has
authentication built into it (and thirdly also sets up any
SSL/TLS
encryption as well).
Cheers!
>
> I'm trying to write a tool that'll automate the sending
out of an
> email to
> ~20,000 people. The SMTP server that I'm using
requires that the
> user login
> with a name and password that have been assigned to
them and I'd
> prefer to
> use that for this tool.
>
> The thing is... I don't plan on sending the email out
immediately
> after
> it's been set up with this tool. I'm planning on
adding a cron job
> that'll
> be ran once a day. It'll look inside a database, see
if there are
> any jobs
> that need to be done, pull the associated username /
password for
> the SMTP
> server from those rows, and perform the job. As such,
if the
> username /
> password that was provided isn't correct, you'll only
know the next
> day.
>
> I would like to remedy this by testing the username /
password
> immediately.
> If it works, we add the job to the database and if it
doesn't, we
> let the
> user know right then and there.
>
> The problem is... I'm not sure how to do this. Here's
some code I
> wrote
> that I thought might do the trick:
>
> <?php
> require_once 'Zend/Mail/Protocol/Smtp/Auth/Login.php';
> $config = array(
> 'auth' => 'login',
> 'username' => '...',
> 'password' => '...',
> 'ssl' => 'tls'
> );
> $test = new
Zend_Mail_Protocol_Smtp_Auth_Login('smtp.server.com', 25,
> $config);
> $test->connect();
> $test->auth();
> ?>
>
> That script gives me the same output regardless of my
using correct or
> incorrect username / password combos:
>
> Fatal error: Uncaught exception
'Zend_Mail_Protocol_Exception' with
> message
> '220 smtp.server.com Microsoft ESMTP MAIL Service ready
at Thu, 22
> May 2008
> 16:41:48 -0500
>
> Any ideas?
> --
> View this message in context: http://www.n
abble.com/confirming-authentication-information-with-Zend_Ma
il--tp17414097p17414097.html
> Sent from the Zend Framework mailing list archive at
Nabble.com.
>
--
Simon Mundy | Director | PEPTOLAB
""" " ""
"""""" ""
"" """""""
" "" """"" "
""""" "
"""""" "" "
202/258 Flinders Lane | Melbourne | Victoria | Australia |
3000
Voice +61 (0) 3 9654 4324 | Mobile 0438 046 061 | Fax +61
(0) 3 9654
4124
http://www.peptolab.com
|