Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[smtplib] how to assure login was succesful?

16 views
Skip to first unread message

maurice

unread,
May 24, 2016, 1:08:17 PM5/24/16
to
Hello to all.

I have the following question:

Once my python script reaches the point where I login in my email account with: server.login(username,password) (where server server = smtplib.SMTP('smtp.office365.com:587')), it returns a tuple like this:

(235,
'2.7.0 Authentication successful target host [address here]')

This method returns a tuple (code, resp). Just want to confirm if I use a variable to store code alone I should check if it is 235 or not, by looking at the reference it seems it is the only code value that does not raise an exception.

Thank you.



dieter

unread,
May 25, 2016, 4:24:12 AM5/25/16
to
maurice <mauricioli...@gmail.com> writes:
> Once my python script reaches the point where I login in my email account with: server.login(username,password) (where server server = smtplib.SMTP('smtp.office365.com:587')), it returns a tuple like this:
>
> (235,
> '2.7.0 Authentication successful target host [address here]')

Try a wrong login. I would expect you to get some kind of exception.

0 new messages