Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #109069 > unrolled thread

[smtplib] how to assure login was succesful?

Started bymaurice <mauricioliveiraguarda@gmail.com>
First post2016-05-24 10:08 -0700
Last post2016-05-25 10:23 +0200
Articles 3 — 3 participants

Back to article view | Back to comp.lang.python


Contents

  [smtplib] how to assure login was succesful? maurice <mauricioliveiraguarda@gmail.com> - 2016-05-24 10:08 -0700
    Re: [smtplib] how to assure login was succesful? Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2016-05-24 20:30 -0400
    Re: [smtplib] how to assure login was succesful? dieter <dieter@handshake.de> - 2016-05-25 10:23 +0200

#109069 — [smtplib] how to assure login was succesful?

Frommaurice <mauricioliveiraguarda@gmail.com>
Date2016-05-24 10:08 -0700
Subject[smtplib] how to assure login was succesful?
Message-ID<b1d2c666-1d1a-4dce-907d-3f0e1336b5d8@googlegroups.com>
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.


  

[toc] | [next] | [standalone]


#109096

FromDennis Lee Bieber <wlfraed@ix.netcom.com>
Date2016-05-24 20:30 -0400
Message-ID<mailman.74.1464136246.20402.python-list@python.org>
In reply to#109069
On Tue, 24 May 2016 10:08:01 -0700 (PDT), maurice
<mauricioliveiraguarda@gmail.com> declaimed the following:

>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.
>

	I would recommend you examine the RFC for SMTP to see what the return
codes could be.

Hmm, 235 may not be a standard response...

https://tools.ietf.org/html/rfc5321#section-4.2.3


Ah... Extended codes...

https://tools.ietf.org/html/rfc5248#section-2.4
https://tools.ietf.org/html/rfc4954#section-6


For the most part, any 2xx code falls into some sort of success category.
-- 
	Wulfraed                 Dennis Lee Bieber         AF6VN
    wlfraed@ix.netcom.com    HTTP://wlfraed.home.netcom.com/

[toc] | [prev] | [next] | [standalone]


#109104

Fromdieter <dieter@handshake.de>
Date2016-05-25 10:23 +0200
Message-ID<mailman.78.1464164641.20402.python-list@python.org>
In reply to#109069
maurice <mauricioliveiraguarda@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.

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web