[issue613708] Add smtplib support for SMTP AUTH LOGIN

2022-04-10 Thread admin


Change by admin :


--
github: None -> 37211

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue460112] SMTP AUTH patch

2022-04-10 Thread admin


Change by admin :


--
github: None -> 35143

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue521270] SMTP does not handle UNICODE

2022-04-10 Thread admin


Change by admin :


--
github: None -> 36135

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue497736] smtplib.py SMTP EHLO/HELO correct

2022-04-10 Thread admin


Change by admin :


--
github: None -> 35847

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue487310] smtplib mishandles SMTP disconnects

2022-04-10 Thread admin


Change by admin :


--
github: None -> 35629

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue424776] SMTP Example does not work

2022-04-10 Thread admin


Change by admin :


--
github: None -> 34513

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34025] SMTP EmailPolicy not using the correct line length for RCF 2045 encoded data (is 78, should be 76)

2021-06-14 Thread Douglas Thor


Change by Douglas Thor :


--
nosy:  -Douglas Thor

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34025] SMTP EmailPolicy not using the correct line length for RCF 2045 encoded data (is 78, should be 76)

2021-06-14 Thread Douglas Thor


Change by Douglas Thor :


--
nosy: +dougthor42

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue36094] When using an SMTP SSL connection,, get ValueError.

2021-02-23 Thread Gert Burger


Change by Gert Burger :


--
nosy: +gertburger

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17612] hooks/mail.py requires [smtp] host to be set, despite a comment to the contrary

2020-12-05 Thread Eric V. Smith


Change by Eric V. Smith :


--
resolution:  -> out of date
stage:  -> resolved
status: pending -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17612] hooks/mail.py requires [smtp] host to be set, despite a comment to the contrary

2020-12-05 Thread Irit Katriel


Irit Katriel  added the comment:

This seems out of date (pre github?)  I couldn't find that comment in the 
current codebase.

--
nosy: +iritkatriel
status: open -> pending

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue36094] When using an SMTP SSL connection,, get ValueError.

2020-12-04 Thread Roundup Robot


Change by Roundup Robot :


--
pull_requests: +22503
pull_request: https://github.com/python/cpython/pull/23635

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue36094] When using an SMTP SSL connection,, get ValueError.

2020-12-03 Thread Roundup Robot


Change by Roundup Robot :


--
nosy: +python-dev
nosy_count: 8.0 -> 9.0
pull_requests: +22499
pull_request: https://github.com/python/cpython/pull/23490

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue36094] When using an SMTP SSL connection,, get ValueError.

2020-10-02 Thread Alice Bevan-McGregor


Alice Bevan-McGregor  added the comment:

Howdy!  One of my projects, Marrow Mailer (formerly TurboMail) has received a 
bit of a flood of reports and erroneous pull requests attempting to correct 
this bug in the invocation of smtplib by Mailer.

https://github.com/marrow/mailer/issues/83 is our own tracking issue, with 
https://github.com/marrow/mailer/pull/91 as the most "successful" pull request 
with more detailed (contextualized) traceback, comparison, and links to 
official documentation. (Also, yay, worked around the problem here by 
recovering my "native" issue tracker account rather than trying to sign in with 
GitHub.)

This appears to be a clear regression. The particular reason why I'm unwilling 
to accept these patches to Mailer is that passing a hostname at SMTP_SSL 
instantiation time will cause the connection to be initiated from within 
__init__ itself, prior to any ability to set the diagnostic logging level, 
which is boo, hiss. Initializers actually doing things is un-good, beyond 
diagnostic logging not being an optional keyword argument.  (Instantiation != 
procedural invocation.)

--
nosy: +amcgregor

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue36094] When using an SMTP SSL connection,, get ValueError.

2020-09-04 Thread Peter Stokes

Peter Stokes  added the comment:

I wanted to enquire as to if/when the proposed PR11998 is likely to be merged?

I also wanted to note the similarity between this issue and issue41470 and to 
suggest that whilst the change proposed in commit e445ccbc of PR11998 [1] would 
be welcome, there may be a case for exposing the value ultimately passed as the 
`server_hostname` parameter to the `SSLContext.wrap_socket(…)` call [2] as a 
parameter to `SMTP.connect(…)` [3]. Doing so would aid potential use cases 
whereby the `host` parameter provided is an address, yet the TLS server 
hostname validation should be based upon another value (i.e. the hostname); 
potentially useful in scenarios where the `host`'s address has been previously 
derived, by the caller, by other means (e.g. a call to `socket.getaddrinfo(…)` 
[4]).

[1] 
https://github.com/python/cpython/pull/11998/commits/e445ccbc483dfde74638dbb694132dc00ced4973
[2] https://docs.python.org/3/library/ssl.html#ssl.SSLContext.wrap_socket
[3] https://docs.python.org/3/library/smtplib.html#smtplib.SMTP.connect
[4] https://docs.python.org/3/library/socket.html#socket.getaddrinfo

--
nosy: +Dadeos

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40157] SMTP email policy does not encode non-ASCII characters

2020-04-02 Thread Eduard Bopp

New submission from Eduard Bopp :

Using email.policy.SMTP a message's non-ASCII characters are not encoded. The 
policy.utf8 attribute is set to False as documented.

The attached script illustrates the behaviour. I get the following command line 
output from it:

Subject: =?utf-8?b?w7zDtsOk?=


False
Subject: üöä


True
Subject: üöä


The default compat32 policy encodes the string, but the SMTP policy does not 
encode it, but leaves it as UTF-8 despite policy.utf8 == False. I might be 
misreading the documentation here, but it seems to me like utf8 == False 
implies that encoding should happen.

--
components: email
files: minimal.py
messages: 365596
nosy: aepsil0n, barry, r.david.murray
priority: normal
severity: normal
status: open
title: SMTP email policy does not encode non-ASCII characters
type: behavior
versions: Python 3.6, Python 3.7, Python 3.8
Added file: https://bugs.python.org/file49026/minimal.py

___
Python tracker 
<https://bugs.python.org/issue40157>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34025] SMTP EmailPolicy not using the correct line length for RCF 2045 encoded data (is 78, should be 76)

2019-05-28 Thread Abhilash Raj


Change by Abhilash Raj :


--
nosy: +maxking

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue36094] When using an SMTP SSL connection,, get ValueError.

2019-02-23 Thread Cheryl Sabella


Cheryl Sabella  added the comment:

tyrone-zhao, thank you for the report and the detail on the commit.

Adding @christian.heimes to the nosylist as he added change this under 
issue19785 and @dstufft as he modified it to be `self._host`.

--
nosy: +cheryl.sabella, christian.heimes, dstufft

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue36094] When using an SMTP SSL connection,, get ValueError.

2019-02-23 Thread SilentGhost


Change by SilentGhost :


--
stage: patch review -> 
type: resource usage -> behavior
versions: +Python 3.8

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue36094] When using an SMTP SSL connection,, get ValueError.

2019-02-23 Thread SilentGhost


Change by SilentGhost :


--
stage:  -> patch review

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue36094] When using an SMTP SSL connection,, get ValueError.

2019-02-23 Thread Roundup Robot


Change by Roundup Robot :


--
keywords: +patch
pull_requests: +12027
stage:  -> patch review

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue36094] When using an SMTP SSL connection,, get ValueError.

2019-02-23 Thread 赵军昱

New submission from 赵军昱 <200612...@qq.com>:

The following bug occurs when you connect after creating an instance of 
SMTP_SSL:
```
import smtplib


smtp_server = "smtp.163.com"
con2 = smtplib.SMTP_SSL()
con2.connect(smtp_server, 465)
```
ValueError:
server_hostname cannot be an empty string or start with a leading dot.
  File "E:\code\noUse.py", line 8, in 
con2.connect(smtp_server, 465)

--
components: email
files: 1.png
messages: 336393
nosy: barry, r.david.murray, tyrone-zhao
priority: normal
severity: normal
status: open
title: When using an SMTP SSL connection,, get ValueError.
type: resource usage
versions: Python 3.7
Added file: https://bugs.python.org/file48167/1.png

___
Python tracker 
<https://bugs.python.org/issue36094>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32657] Mutable Objects in SMTP send_message Signature

2019-02-21 Thread Inada Naoki


Change by Inada Naoki :


--
versions: +Python 3.8 -Python 3.6, Python 3.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32657] Mutable Objects in SMTP send_message Signature

2019-02-21 Thread Inada Naoki


Change by Inada Naoki :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32680] smtplib SMTP instances missing a default sock attribute

2018-10-09 Thread Giampaolo Rodola'


Giampaolo Rodola'  added the comment:

PR merged for 3.8 branch. I don't think such a simple change deserves a 
backport for previous Python versions. Closing this out as resolved.

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
versions: +Python 3.8

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32680] smtplib SMTP instances missing a default sock attribute

2018-10-09 Thread Giampaolo Rodola'


Giampaolo Rodola'  added the comment:


New changeset 7b313971805ca9b53f181f7b97e5376d0b89dc06 by Giampaolo Rodola 
(Romuald Brunet) in branch 'master':
bpo-32680 add default "sock" on SMTP objects (#5345)
https://github.com/python/cpython/commit/7b313971805ca9b53f181f7b97e5376d0b89dc06


--
nosy: +giampaolo.rodola

___
Python tracker 
<https://bugs.python.org/issue32680>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34025] SMTP EmailPolicy not using the correct line length for RCF 2045 encoded data (is 78, should be 76)

2018-08-27 Thread AldarisPale


AldarisPale  added the comment:

Hi!

I hit this bug on python 3.4.

For the reference here are two email sources. The first one works while the 
second one does not. Both were produced using smtplib the only difference being 
the workaround proposed by Douglas Thor.
I hit this bug when using K-9 mail for reading e-mails.
Relevant github link: 
https://github.com/k9mail/k-9/issues/1659#issuecomment-416074768

This one works:
---

Return-Path: 
X-Original-To: recei...@receiverdomain.com
Delivered-To: recei...@receiverdomain.com
Received: from [127.0.0.1] (smtp [127.0.0.1])
by smtp.receiverdomain.com (Postfix) with ESMTP id 2697F23C0063
for ; Mon, 27 Aug 2018 09:20:15 +0300 
(EEST)
Subject: Malformed base64
From: sen...@senderdomain.com
To: recei...@receiverdomain.com
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: base64
MIME-Version: 1.0
Message-Id: <20180827062015.2697f23c0...@smtp.receiverdomain.com>
Date: Mon, 27 Aug 2018 09:20:15 +0300 (EEST)

Q09OVEVOVF9MRU5HVEg6IDEyMzQ1Njc4OTBhYmNkZWYNCkNPTlRFTlRfVFlQRTogMTIzNDU2Nzg5
MGFiY2RlZg0KQ09OVEVYVF9ET0NVTUVOVF9ST09UOiAxMjM0NTY3ODkwYWJjZGVmDQpDT05URVhU
X1BSRUZJWDogMTIzNDU2Nzg5MGFiY2RlZg0KRE9DVU1FTlRfUk9PVDogMTIzNDU2Nzg5MGFiY2Rl
Zg0KR0FURVdBWV9JTlRFUkZBQ0U6IDEyMzQ1Njc4OTBhYmNkZWYNCkhUVFBTOiAxMjM0NTY3ODkw
YWJjZGVmDQpIVFRQX0FDQ0VQVDogMTIzNDU2Nzg5MGFiY2RlZg0KSFRUUF9BQ0NFUFRfRU5DT0RJ
Tkc6IDEyMzQ1Njc4OTBhYmNkZWYNCkhUVFBfQUNDRVBUX0xBTkdVQUdFOiAxMjM0NTY3ODkwYWJj
ZGVmDQpIVFRQX0NBQ0hFX0NPTlRST0w6IDEyMzQ1Njc4OTBhYmNkZWYNCkhUVFBfQ09OTkVDVElP
TjogMTIzNDU2Nzg5MGFiY2RlZg0KSFRUUF9ETlQ6IDEyMzQ1Njc4OTBhYmNkZWYNCkhUVFBfSE9T
VDogMTIzNDU2Nzg5MGFiY2RlZg0KSFRUUF9PUklHSU46IDEyMzQ1Njc4OTBhYmNkZWYNCkhUVFBf
UkVGRVJFUjogMTIzNDU2Nzg5MGFiY2RlZg0KSFRUUF9VUEdSQURFX0lOU0VDVVJFX1JFUVVFU1RT
OiAxMjM0NTY3ODkwYWJjZGVmDQpIVFRQX1VTRVJfQUdFTlQ6IDEyMzQ1Njc4OTBhYmNkZWYNClBB
VEg6IDEyMzQ1Njc4OTBhYmNkZWYNClFVRVJZX1NUUklORzogMTIzNDU2Nzg5MGFiY2RlZg0KUkVE
SVJFQ1RfSFRUUFM6IDEyMzQ1Njc4OTBhYmNkZWYNClJFRElSRUNUX1NTTF9UTFNfU05JOiAxMjM0
NTY3ODkwYWJjZGVmDQpSRURJUkVDVF9TVEFUVVM6IDEyMzQ1Njc4OTBhYmNkZWYNClJFRElSRUNU
X1VOSVFVRV9JRDogMTIzNDU2Nzg5MGFiY2RlZg0KUkVESVJFQ1RfVVJMOiAxMjM0NTY3ODkwYWJj
ZGVmDQpSRU1PVEVfQUREUjogMTIzNDU2Nzg5MGFiY2RlZg0KUkVNT1RFX1BPUlQ6IDEyMzQ1Njc4
OTBhYmNkZWYNClJFUVVFU1RfTUVUSE9EOiAxMjM0NTY3ODkwYWJjZGVmDQpSRVFVRVNUX1NDSEVN
RTogMTIzNDU2Nzg5MGFiY2RlZg0KUkVRVUVTVF9VUkk6IDEyMzQ1Njc4OTBhYmNkZWYNClNDUklQ
VF9GSUxFTkFNRTogMTIzNDU2Nzg5MGFiY2RlZg0KU0NSSVBUX05BTUU6IDEyMzQ1Njc4OTBhYmNk
ZWYNClNFUlZFUl9BRERSOiAxMjM0NTY3ODkwYWJjZGVmDQpTRVJWRVJfQURNSU46IDEyMzQ1Njc4
OTBhYmNkZWYNClNFUlZFUl9OQU1FOiAxMjM0NTY3ODkwYWJjZGVmDQpTRVJWRVJfUE9SVDogMTIz
NDU2Nzg5MGFiY2RlZg0KU0VSVkVSX1BST1RPQ09MOiAxMjM0NTY3ODkwYWJjZGVmDQpTRVJWRVJf
U0lHTkFUVVJFOiAxMjM0NTY3ODkwYWJjZGVmDQpTRVJWRVJfU09GVFdBUkU6IDEyMzQ1Njc4OTBh
YmNkZWYNClNTTF9UTFNfU05JOiAxMjM0NTY3ODkwYWJjZGVmDQpVTklRVUVfSUQ6IDEyMzQ1Njc4
OTBhYmNkZWYNCg==


This one does not:
--

Return-Path: 
X-Original-To: recei...@receiverdomain.com
Delivered-To: recei...@receiverdomain.com
Received: from [127.0.0.1] (smtp [127.0.0.1])
by smtp.receiverdomain.com (Postfix) with ESMTP id 0D25523C0063
for ; Mon, 27 Aug 2018 09:21:13 +0300 
(EEST)
Subject: Malformed base64
From: sen...@senderdomain.com
To: recei...@receiverdomain.com
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: base64
MIME-Version: 1.0
Message-Id: <20180827062113.0d25523c0...@smtp.receiverdomain.com>
Date: Mon, 27 Aug 2018 09:21:13 +0300 (EEST)

Q09OVEVOVF9MRU5HVEg6IDEyMzQ1Njc4OTBhYmNkZWYKQ09OVEVOVF9UWVBFOiAxMjM0NTY3ODkwYQ==
YmNkZWYKQ09OVEVYVF9ET0NVTUVOVF9ST09UOiAxMjM0NTY3ODkwYWJjZGVmCkNPTlRFWFRfUFJFRg==
SVg6IDEyMzQ1Njc4OTBhYmNkZWYKRE9DVU1FTlRfUk9PVDogMTIzNDU2Nzg5MGFiY2RlZgpHQVRFVw==
QVlfSU5URVJGQUNFOiAxMjM0NTY3ODkwYWJjZGVmCkhUVFBTOiAxMjM0NTY3ODkwYWJjZGVmCkhUVA==
UF9BQ0NFUFQ6IDEyMzQ1Njc4OTBhYmNkZWYKSFRUUF9BQ0NFUFRfRU5DT0RJTkc6IDEyMzQ1Njc4OQ==
MGFiY2RlZgpIVFRQX0FDQ0VQVF9MQU5HVUFHRTogMTIzNDU2Nzg5MGFiY2RlZgpIVFRQX0NBQ0hFXw==
Q09OVFJPTDogMTIzNDU2Nzg5MGFiY2RlZgpIVFRQX0NPTk5FQ1RJT046IDEyMzQ1Njc4OTBhYmNkZQ==
ZgpIVFRQX0ROVDogMTIzNDU2Nzg5MGFiY2RlZgpIVFRQX0hPU1Q6IDEyMzQ1Njc4OTBhYmNkZWYKSA==
VFRQX09SSUdJTjogMTIzNDU2Nzg5MGFiY2RlZgpIVFRQX1JFRkVSRVI6IDEyMzQ1Njc4OTBhYmNkZQ==
ZgpIVFRQX1VQR1JBREVfSU5TRUNVUkVfUkVRVUVTVFM6IDEyMzQ1Njc4OTBhYmNkZWYKSFRUUF9VUw==
RVJfQUdFTlQ6IDEyMzQ1Njc4OTBhYmNkZWYKUEFUSDogMTIzNDU2Nzg5MGFiY2RlZgpRVUVSWV9TVA==
UklORzogMTIzNDU2Nzg5MGFiY2RlZgpSRURJUkVDVF9IVFRQUzogMTIzNDU2Nzg5MGFiY2RlZgpSRQ==
RElSRUNUX1NTTF9UTFNfU05JOiAxMjM0NTY3ODkwYWJjZGVmClJFRElSRUNUX1NUQVRVUzogMTIzNA==
NTY3ODkwYWJjZGVmClJFRElSRUNUX1VOSVFVRV9JRDogMTIzNDU2Nzg5MGFiY2RlZgpSRURJUkVDVA==
X1VSTDogMTIzNDU2Nzg5MGFiY2RlZgpSRU1PVEVfQUREUjogMTIzNDU2Nzg5MGFiY2RlZgpSRU1PVA==
RV9QT1JUOiAxMjM0NTY3ODkwYWJjZGVmClJFUVVFU1RfTUVUSE9EOiAxMjM0NTY3ODkwYWJjZGVmCg==
UkVRVUVTVF9TQ0hFTUU6IDEyMzQ1Njc4OTBhYmNkZWYKUkVRVUVTVF9VUkk6IDEyMzQ1Njc4OTBhYg==
Y2RlZgpTQ1JJUFRfRklMRU5BTUU6IDEyMzQ1Njc4OTBhYm

[issue32657] Mutable Objects in SMTP send_message Signature

2018-08-20 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

See also issue34246.

--
nosy: +serhiy.storchaka

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34025] SMTP EmailPolicy not using the correct line length for RCF 2045 encoded data (is 78, should be 76)

2018-07-02 Thread R. David Murray


R. David Murray  added the comment:

The default maximum line length is indeed supposed to be 78 (characters..and I 
can't now remember whether I implemented it in terms of characters or octets), 
that's per RFC 5322.  What is wrong is that content encoded text is supposed to 
use a max line length of 76.

A "simple" fix would be to hardcode the maximum line length at 76 when doing 
content encoding.  An arguably better fix would be a separate policy control 
for the encoded text line length.

The former can be the bug fix, but it would be nice to have the latter as an 
enhancement.

--
title: SMTP EmailPolicy not setting max_line_length as expected. RCF 2045 
states 76 char, Default policy uses 78 -> SMTP EmailPolicy not using the 
correct line length for RCF 2045 encoded data (is 78, should be 76)

___
Python tracker 
<https://bugs.python.org/issue34025>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34025] SMTP EmailPolicy not setting max_line_length as expected. RCF 2045 states 76 char, Default policy uses 78

2018-07-02 Thread Douglas Thor


New submission from Douglas Thor :

It appears that the SMTP EmailPolicy object does not correctly set 
max_line_length.

RFC 2045 (https://www.ietf.org/rfc/rfc2045.txt) requires a max_line_length of 
76 characters, while email._policybase.Policy sets it to 78 (which typically is 
correct).

This causes email attachments to be truncated/corrupted.

While the workaround is quite trivial, debugging the root cause was not as 
easy. Thus I think this should be fixed in at the std lib level, or at the very 
least mentioned in the docs.

This was tested on Python 3.5.2. I did not test on 3.7, but I did check the 
source code and it appears that the bug still exists.



To reproduce:

import smtplib
from email.message import EmailMessage
from email.policy import SMTP

msg = EmailMessage()
msg['Subject'] = "Test message"
msg['To'] = "to@valid_address.com"
msg['From'] = "from@valid_address.com"
content = "hello world, I should have an attachment"
msg.set_content(content)

maintype = 'image'
subtype = 'png'
test_file = './aaa.png'

with open(test_file, 'rb') as fp:
data = fp.read()
msg.add_attachment(data,
   maintype=maintype,
   subtype=subtype,
   filename='aaa.png')

with smtplib.SMTP_SSL('smtp.address.com', port=465) as s:
s.ehlo()
user = 'smtp_user@valid_address.com'
pw = 'smtp_password'
s.login(user, pw)
s.send_message(msg)



Check the raw email message received. You'll see that lines have a length of 78 
and are padded with "==" which makes the total length 80 chars:

...
MIME-Version: 1.0
Content-Type: multipart/mixed; 
boundary="===1585876390557366757=="

--===1585876390557366757==
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 7bit

hello world, I should have an attachment

--===1585876390557366757==
Content-Type: image/png
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="aaa.png"
MIME-Version: 1.0


iVBORw0KGgoNSUhEUgAABE0AAALFCAY2rB2uAXNSR0IArs4c6QRnQU1BAACxjw==

C/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAD/jklEQVR4Xg==

7P1rsHVJWecBvl4RFFAuIpcCEYQuLkUDBcgBoQsULLnJXaoaEApe5FLSTVFUC4JACQ1NiQdsQoFBAQ==

iW4aQSWEt4cQwwB6xqC+CPYHqX5jQno+jHyYCCMmZsKJmYjZs3/rnOe8uXNnrpW5LrlzrfVfVSfOeQ==

986Vl/+T678y//nkk9+3OXdu+78uISAEhIAQEAJCQAgIASEgBISAEBACQkAICIEdBBBN9CMM1AfUBw==
...



Next, modify the code with:

from email.policy import SMTP
smtp_pol = SMTP.clone(max_line_length=76)
msg = EmailMessage(policy=smtp_pol)
msg['Subject'] = ...



And check the raw email again. This time, lines are 76 chars long and have no 
padding. Data is the same, just wrapped differently as expected.

...
MIME-Version: 1.0
Content-Type: multipart/mixed;
 boundary="===4874323426669347622=="

--===4874323426669347622==
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 7bit

hello world, I should have an attachment

--===4874323426669347622==
Content-Type: image/png
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="aaa.png"
MIME-Version: 1.0

iVBORw0KGgoNSUhEUgAABE0AAALFCAY2rB2uAXNSR0IArs4c6QRnQU1BAACx
jwv8YQUgY0hSTQAAeiYAAICEAAD6gOgAAHUwAADqYAAAOpgAABdwnLpRPAAA/45JREFU
eF7s/WuwdUlZ5wG+XhEUUC4ilwIRhC4uRQMFyAGhCxQsucldqhoQCl7kUtJNUVQLgkAJDU2JB2xC
gUEBiW4aQSWEt4cQwwB6xqC+CPYHqX5jQno+jHyYCCMmZsKJmYjZs3/rnOe8uXNnrpW5LrlzrfVf
...



This fix *should* be extremely easy:

diff --git "a/policy.py" "b/policy.py"
index 6ac64a5..046b788 100644
--- "a/policy.py"
+++ "b/policy.py"
@@ -209,6 +209,6 @@ default = EmailPolicy()
 # Make the default policy use the class default header_factory
 del default.header_factory
 strict = default.clone(raise_on_defect=True)
-SMTP = default.clone(linesep='\r\n')
+SMTP = default.clone(linesep='\r\n', max_line_length=76)
 HTTP = default.clone(linesep='\r\n', max_line_length=None)
 SMTPUTF8 = SMTP.clone(utf8=True)

--
components: email
messages: 320898
nosy: Douglas Thor, barry, r.david.murray
priority: normal
severity: normal
status: open
title: SMTP EmailPolicy not setting max_line_length as expected. RCF 2045 
states 76 char, Default policy uses 78
type: behavior
versions: Python 3.5

___
Python tracker 
<https://bugs.python.org/issue34025>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32680] smtplib SMTP instances missing a default sock attribute

2018-02-03 Thread amirjn

amirjn  added the comment:

apple.com

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32680] smtplib SMTP instances missing a default sock attribute

2018-02-03 Thread amirjn

amirjn  added the comment:

same problem at apple.com

--
nosy: +amirjn

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32680] smtplib SMTP instances missing a default sock attribute

2018-01-26 Thread Stéphane Wirtel

Stéphane Wirtel <steph...@wirtel.be> added the comment:

You are right, but...

if there is an exception in the connect method before the init of
self.sock, the sock attribute will not exist and in this case, and only
in this case, there will be an exception in the close method.

your code will work fine if you use a try/finally but not in the case
where we use the with statement, for example.

with SMTP('myhost') as smtp:
   smtp.do_something()

If there is an exception in the __init__ of SMTP and self.sock is not
initialized -> traceback.

--
nosy: +matrixise

___
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue32680>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32680] smtplib SMTP instances missing a default sock attribute

2018-01-26 Thread Romuald Brunet

Romuald Brunet <romuald.bru...@gmail.com> added the comment:

My use case:

try:
  s = SMTP('myhost')
  s.do_some_sending()
finaly:
  if s is not None and s.sock is not None:
s.quit()

But I realize just now that in that case, if s was initialized correctly, its 
sock was inevitably set

--

___
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue32680>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32680] smtplib SMTP instances missing a default sock attribute

2018-01-26 Thread Romuald Brunet

Change by Romuald Brunet :


--
keywords: +patch
pull_requests: +5192
stage:  -> patch review

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32680] smtplib SMTP instances missing a default sock attribute

2018-01-26 Thread Romuald Brunet

New submission from Romuald Brunet <romuald.bru...@gmail.com>:

SMTP instances from the smtplib module are not creating their sock attribute 
consistently after __init__

When host is sent as parameter a sock object is created (and hopefully, 
connected)

When the host is not sent, the sock attribute doesn't exist at all

--
messages: 310764
nosy: Romuald
priority: normal
severity: normal
status: open
title: smtplib SMTP instances missing a default sock attribute

___
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue32680>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32657] Mutable Objects in SMTP send_message Signature

2018-01-25 Thread Chason Chaffin

Chason Chaffin  added the comment:

> It's probably enough to fix it.  I fear that if we also change them in 
> sendmail we'll break someone's code, but maybe we should do that anyway, for 
> 3.7 only.

Should I make a separate issue for that, or attach it to this PR?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32657] Mutable Objects in SMTP send_message Signature

2018-01-25 Thread R. David Murray

R. David Murray  added the comment:

It's probably enough to fix it.  I fear that if we also change them in sendmail 
we'll break someone's code, but maybe we should do that anyway, for 3.7 only.

--
versions:  -Python 2.7, Python 3.4, Python 3.5, Python 3.8

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32657] Mutable Objects in SMTP send_message Signature

2018-01-25 Thread Chason Chaffin

Change by Chason Chaffin :


--
keywords: +patch
pull_requests: +5180
stage:  -> patch review

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32657] Mutable Objects in SMTP send_message Signature

2018-01-25 Thread Chason Chaffin

Chason Chaffin  added the comment:

I'm writing a PR for this right now. Is it worth it to write a test to make 
sure that mail_options isn't being mutated or is it enough just to update the 
code to use non-mutable defaults? Interesting side effect of looking into this 
is #32663 where I found the tests for the UTF8 code weren't being run.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32657] Mutable Objects in SMTP send_message Signature

2018-01-25 Thread R. David Murray

R. David Murray <rdmur...@bitdance.com> added the comment:

On Thu, 25 Jan 2018 15:18:01 +, Steven D'Aprano <rep...@bugs.python.org> 
wrote:
> On Thu, Jan 25, 2018 at 02:28:17PM +, R. David Murray wrote:
> The docstring for send_message does say 
> 
> If the sender or any of the recipient addresses contain non-ASCII
> and the server advertises the SMTPUTF8 capability, the policy is
> cloned with utf8 set to True for the serialization, and SMTPUTF8
> and BODY=8BITMIME are asserted on the send.

"Asserted" means sent with the SMTP commands.  It could be reworded to
be clearer.

> which I don't really understand, but I thought that perhaps it was a 
> typo for *inserted* on the send, in the sense of inserted into the mail 
> options:
> 
> mail_options += ['SMTPUTF8', 'BODY=8BITMIME']

Even if that had been true, it would still be a bug to do it to the
mutable argument :)

> So are we agreed this is a bug? What about the default for rcpt_options 
> being a dict?

I didn't look at that, but it probably is.

--

___
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue32657>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32657] Mutable Objects in SMTP send_message Signature

2018-01-25 Thread Steven D'Aprano

Steven D'Aprano  added the comment:

On Thu, Jan 25, 2018 at 02:28:17PM +, R. David Murray wrote:

> obviously I missed that mutation of the value 
> in the code review of the patch that added those lines :(

The docstring for send_message does say 

If the sender or any of the recipient addresses contain non-ASCII
and the server advertises the SMTPUTF8 capability, the policy is
cloned with utf8 set to True for the serialization, and SMTPUTF8
and BODY=8BITMIME are asserted on the send.

which I don't really understand, but I thought that perhaps it was a 
typo for *inserted* on the send, in the sense of inserted into the mail 
options:

mail_options += ['SMTPUTF8', 'BODY=8BITMIME']

So are we agreed this is a bug? What about the default for rcpt_options 
being a dict?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32657] Mutable Objects in SMTP send_message Signature

2018-01-25 Thread R. David Murray

R. David Murray  added the comment:

Chason: that does look like a bug.

Mutable defaults are best to avoid, but if they are used read-only and not 
passed down further it isn't a problem.  send_message was modeled on sendmail, 
and so copied it's use of defaults (which date from quite some time back :), 
but obviously I missed that mutation of the value in the code review of the 
patch that added those lines :(

--
nosy: +r.david.murray

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32657] Mutable Objects in SMTP send_message Signature

2018-01-24 Thread Chason Chaffin

Chason Chaffin <cha...@gmail.com> added the comment:

Hi Steven,

I have nothing to do with the original submitter but this bug did catch my eye. 
Does using mutable variables in the SMTP library serve a purpose? Looking 
through the code, I wasn't able to spot anything obvious, and I did spot a 
place with a potential bug:

https://github.com/python/cpython/blob/master/Lib/smtplib.py#L960

Here mail_options is mutated in the case of a non-ASCII email address. 
Subsequent calls to send_message, even to a different SMTP server (if I'm not 
mistaken) would also send these headers along.

--
nosy: +chason

___
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue32657>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32657] Mutable Objects in SMTP send_message Signature

2018-01-24 Thread Steven D'Aprano

Steven D'Aprano  added the comment:

Hi Kenny, and thanks, but I'm not sure what your point is. Are you claiming 
this is a bug in the code or the documentation?

For what it is worth... mutable defaults *are* a "gotcha", so the documentation 
isn't wrong. And mutable defaults are *not* illegal nor a bug and are 
occasionally useful. So I'm not sure why you are reporting this? Have you found 
a problem?

(I see that send_message gives rcpt_options a default of {} (empty dict) and 
then passes it to sendmail, which expects rcpt_options to be a list. I don't 
know if that matters.)

--
nosy: +steven.daprano

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32657] Mutable Objects in SMTP send_message Signature

2018-01-24 Thread Kenny Trytek

New submission from Kenny Trytek <kenny.try...@workiva.com>:

Mutable arguments in signature of send_message:
https://github.com/python/cpython/blob/master/Lib/smtplib.py#L892-L893

More Information:
http://docs.python-guide.org/en/latest/writing/gotchas/#mutable-default-arguments

--
components: Library (Lib)
messages: 310641
nosy: Kenny Trytek
priority: normal
severity: normal
status: open
title: Mutable Objects in SMTP send_message Signature
versions: Python 2.7, Python 3.4, Python 3.5, Python 3.6, Python 3.7, Python 3.8

___
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue32657>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue25008] Deprecate smtpd (based on deprecated asyncore/asynchat): write a new smtp server with asyncio

2016-11-17 Thread Giampaolo Rodola'

Changes by Giampaolo Rodola' :


--
nosy: +giampaolo.rodola

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10852] SSL/TLS sni use in smtp, pop, imap, nntp, ftp client libs by default

2016-09-08 Thread Christian Heimes

Christian Heimes added the comment:

Oh sorry, this is about SNI not verified context. All protocols support SNI for 
some time.

--
resolution:  -> out of date
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10852] SSL/TLS sni use in smtp, pop, imap, nntp, ftp client libs by default

2016-09-08 Thread Christian Heimes

Christian Heimes added the comment:

Good idea, but the patch is outdated. We can enforce verification by changing 
ssl._create_stdlib_context.

--
assignee:  -> christian.heimes
nosy: +alex, dstufft, janssen
priority: normal -> high
versions: +Python 3.6, Python 3.7 -Python 3.4

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9297] SMTP with Sqlite3 file attached problem

2016-03-27 Thread Berker Peksag

Berker Peksag added the comment:

> Unless someone can reproduce the issue, I recommend that we close this ticket.

I couldn't reproduce it either.

--
nosy: +berker.peksag
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



aiosmtpd 1.0a1 - asyncio-based implementations of SMTP/LMTP

2015-10-20 Thread Barry Warsaw
I'm very happy to announce the first alpha release of aiosmtpd, an
asyncio-based implementation of SMTP and LMTP.

http://aiosmtpd.readthedocs.org/en/latest/
https://pypi.python.org/pypi/aiosmtpd/1.0a1

This library can be used as a standalone server, or as a testing framework for
applications that send email.  It's inspired by several previous packages
including the stdlib smtpd.py, lazr.smtptest, Benjamin Bader's aiosmtp, and
submodules in GNU Mailman.

This is an alpha release, so it can obviously use lots of feedback, and
contributions are very much welcome.  We're developing the library on GitLab;
see the RTD link above for details.

Brought to you by the aiosmtpd hacking cabal of Andrew Kuchling, Eric Smith,
Jason Coombs, R. David Murray and myself.

Our aim is to include aiosmtpd in the Python 3.6 stdlib as a better
alternative to smtpd.py.

Cheers,
-Barry


pgpqvfdL4izFI.pgp
Description: OpenPGP digital signature
-- 
https://mail.python.org/mailman/listinfo/python-announce-list

Support the Python Software Foundation:
http://www.python.org/psf/donations/


[issue25008] Deprecate smtpd (based on deprecated asyncore/asynchat): write a new smtp server with asyncio

2015-10-16 Thread Barry A. Warsaw

Barry A. Warsaw added the comment:

This has come along pretty well.  The project is managed here:

https://gitlab.com/python-smtpd-hackers/aiosmtpd

and documentation here:

http://aiosmtpd.readthedocs.org/en/latest/

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue25008] Deprecate smtpd (based on deprecated asyncore/asynchat): write a new smtp server with asyncio

2015-10-08 Thread neic

Changes by neic :


--
nosy: +neic

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue25008] Deprecate smtpd (based on deprecated asyncore/asynchat): write a new smtp server with asyncio

2015-10-04 Thread Barry A. Warsaw

Barry A. Warsaw added the comment:

I'm liking RDM's port of smtpd.py.  I've done some clean ups, bug fixes, and 
added some debugging.  See this branch over on gitlab:

https://gitlab.com/python-smtpd-hackers/aiosmtpd/tree/issue25508

Try `python3 server.py` then run client.py in another terminal (it uses 
smtplib) or just telnet.

I plan to continue pursuing this approach; please comment over there.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue25008] Deprecate smtpd (based on deprecated asyncore/asynchat): write a new smtp server with asyncio

2015-09-27 Thread R. David Murray

R. David Murray added the comment:

Here is a proof of concept port of smtpd to asyncio.  Obviously I'm not 
suggesting we commit this patch (it isn't complete...the tests don't run).  
Instead I'm posting it as an outgrowth the of the sprint that was conducted 
today.  The DC team took a different tack, so I'm not submitting this as a 
patch to their repo, and since it is useful to look at the diff against 
default, it seems appropriate to post it here.

The advantage of this port is that it uses the existing smtpd protocol code, 
which is the "field tested" code.  Of course, I did have to change how the data 
is turned from bytes into lines, so I may have introduced some bugs.

As discussed, *using* an asyncio based smtpd has a different calling API than 
using the asynchat one.  However, the *pattern* is similar, so it may not be 
crazy to replace smtpd with the cleaned up version of this patch, exactly 
because the number of places this is used is relatively small and mostly in 
test code.  IMO it's a better option than deleting smtpd from the stdlib.

The code as is can be run using its CLI.  I tested it via telnet using the 
DebuggingServer and hand coding an email...for some reason I can't currently 
import smtplib (Enum errors in socket), so I didn't test it with smtplib, but 
it should work.

--
keywords: +patch
Added file: http://bugs.python.org/file40605/aiosmtpd.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue25008] Deprecate smtpd (based on deprecated asyncore/asynchat): write a new smtp server with asyncio

2015-09-18 Thread STINNER Victor

Changes by STINNER Victor <victor.stin...@gmail.com>:


--
title: Deprecate smtpd -> Deprecate smtpd (based on deprecated 
asyncore/asynchat): write a new smtp server with asyncio

___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue25008>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1521196] smtplib login fails with aol smtp server

2014-04-15 Thread R. David Murray

R. David Murray added the comment:

This will be fixed as part of issue 15014, which also adds support for 
providing user created auth methods.

--
resolution:  - duplicate
stage: test needed - committed/rejected
status: open - closed
superseder:  - smtplib: add support for arbitrary auth methods

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1521196
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: Using pythons smtp server

2013-12-14 Thread Irmen de Jong
On 14-12-2013 1:46, Dennis Lee Bieber wrote:

   About then, I discovered the first two significant books on Python at
 Computer Literacy, and that an Amiga binary was available (Python 1.4, I
 think -- thanks, Irmin).

You're welcome, but my name is spelled Irmen, with an 'e' ;-)

Cheers
Irmen


-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Using pythons smtp server

2013-12-13 Thread Grant Edwards
On 2013-12-13, Vincent Davis vinc...@vincentdavis.net wrote:

 I have an app that generates a file one a day and would like to email it
 using pythons SMTP server.

You don't send mail using an SMTP server.  You receive mail using an
SMTP server.

 http://docs.python.org/2/library/smtpd.html#smtpd.SMTPServer
 The documentation is kinda sparse and I cant seem to find any good examples.

 Basically what I want to do; when my app runs it would initiate a SMTP
 server, send the attachment and shutdown the SMTP after.

Newsgroups: comp.lang.python
From: Grant Edwards invalid@invalid.invalid
Subject: Re: Using pythons smtp server
References: mailman.4046.1386908855.18130.python-l...@python.org
Followup-To:

On 2013-12-13, Vincent Davis vinc...@vincentdavis.net wrote:

 I have an app that generates a file one a day and would like to email
 it using pythons SMTP server.

You don't send mail using an SMTP server.  You receive mail using an 
SMTP server.  You send mail using an SMTP client.

 http://docs.python.org/2/library/smtpd.html#smtpd.SMTPServer
 The documentation is kinda sparse and I cant seem to find any good examples.

 Basically what I want to do; when my app runs it would initiate a SMTP
 server, send the attachment and shutdown the SMTP after.

https://www.google.com/search?q=python+send+email+smtp

-- 
Grant Edwards   grant.b.edwardsYow! The PINK SOCKS were
  at   ORIGINALLY from 1952!!
  gmail.comBut they went to MARS
   around 1953!!
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Using pythons smtp server

2013-12-13 Thread Vincent Davis

 You don't send mail using an SMTP server.  You receive mail using an
 SMTP server.
 ​​


Um maybe, I guess it is a matter of perspective.

Let me rephrase my question. ​​I want to send an email using python but do
not want to use an external service. Does python have the ability to send
emails without installing additional software or using an external
server/service?
Maybe I am wrong, I thought examples like s = smtplib.SMTP('localhost')
​​ are using a local(outside of python) smtp server, like postfix.




Vincent Davis
720-301-3003


On Fri, Dec 13, 2013 at 9:40 AM, Grant Edwards invalid@invalid.invalidwrote:

 On 2013-12-13, Vincent Davis vinc...@vincentdavis.net wrote:

  I have an app that generates a file one a day and would like to email it
  using pythons SMTP server.

 You don't send mail using an SMTP server.  You receive mail using an
 SMTP server.

  http://docs.python.org/2/library/smtpd.html#smtpd.SMTPServer
  The documentation is kinda sparse and I cant seem to find any good
 examples.
 
  Basically what I want to do; when my app runs it would initiate a SMTP
  server, send the attachment and shutdown the SMTP after.

 Newsgroups: comp.lang.python
 From: Grant Edwards invalid@invalid.invalid
 Subject: Re: Using pythons smtp server
 References: mailman.4046.1386908855.18130.python-l...@python.org
 Followup-To:

 On 2013-12-13, Vincent Davis vinc...@vincentdavis.net wrote:

  I have an app that generates a file one a day and would like to email
  it using pythons SMTP server.

 You don't send mail using an SMTP server.  You receive mail using an
 SMTP server.  You send mail using an SMTP client.

  http://docs.python.org/2/library/smtpd.html#smtpd.SMTPServer
  The documentation is kinda sparse and I cant seem to find any good
 examples.
 
  Basically what I want to do; when my app runs it would initiate a SMTP
  server, send the attachment and shutdown the SMTP after.

 https://www.google.com/search?q=python+send+email+smtp

 --
 Grant Edwards   grant.b.edwardsYow! The PINK SOCKS were
   at   ORIGINALLY from 1952!!
   gmail.comBut they went to MARS
around 1953!!
 --
 https://mail.python.org/mailman/listinfo/python-list

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Using pythons smtp server

2013-12-13 Thread Vincent Davis
Obviously I don't really know how this works. I have used python to send
email using my smtp server (whatever that may be gmail, postfix..)
But I don't want to do that. After a little more research I think what I
need to do is lookup the MX address of the address I want to send the email
too.
Then submit the email to that address using smtplib.SMTP
​Do I have that right?
​


Vincent Davis
720-301-3003


On Fri, Dec 13, 2013 at 10:24 AM, Dennis Lee Bieber
wlfr...@ix.netcom.comwrote:

 On Thu, 12 Dec 2013 18:01:58 -0700, Vincent Davis
 vinc...@vincentdavis.net declaimed the following:

 I have an app that generates a file one a day and would like to email it
 using pythons SMTP server.
 http://docs.python.org/2/library/smtpd.html#smtpd.SMTPServer
 The documentation is kinda sparse and I cant seem to find any good
 examples.
 
 Basically what I want to do; when my app runs it would initiate a SMTP
 server, send the attachment and shutdown the SMTP after.
 

 I suspect you don't want the server per se -- that's more a unit
 for
 receiving SMTP mail (sure, you can start it, but then you have to send the
 email to IT so it can relay it to the next server in the line).

 Look into the smtplib module (section 20.12 in the v2.7.2
 documentation) in order to send email TO a mail server
 --
 Wulfraed Dennis Lee Bieber AF6VN
 wlfr...@ix.netcom.comHTTP://wlfraed.home.netcom.com/

 --
 https://mail.python.org/mailman/listinfo/python-list

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Using pythons smtp server

2013-12-13 Thread Grant Edwards
On 2013-12-13, Vincent Davis vinc...@vincentdavis.net wrote:

 Obviously I don't really know how this works. I have used python to
 send email using my smtp server (whatever that may be gmail,
 postfix..) But I don't want to do that. After a little more research
 I think what I need to do is lookup the MX address of the address I
 want to send the email too.

 Then submit the email to that address using smtplib.SMTP

Maybe.  In theory, that will work -- and it did in the good old days
before SPAM (the electric kind) was invented.

But, many SMTP servers (the ones pointed to by the MX record) will not
accept mail from you unless you meet various requirements (which vary
considerably and the SMTP servers administrators try to keep secret).

For example you may have to be sending from an IP address who's
reverse-DNS lookup matches up with the from headers and with the MX
record for the domain you claim to be sending from.

Your mail might also get blocked/discarded if you're sending from
what's been identified as a dynamically allocated IP block (even if it
does have proper DNS and MX records).

-- 
Grant Edwards   grant.b.edwardsYow! Look into my eyes and
  at   try to forget that you have
  gmail.coma Macy's charge card!
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Using pythons smtp server

2013-12-13 Thread Chris Angelico
On Sat, Dec 14, 2013 at 4:13 AM, Vincent Davis vinc...@vincentdavis.net wrote:
 Let me rephrase my question. I want to send an email using python but do not
 want to use an external service. Does python have the ability to send emails
 without installing additional software or using an external server/service?

Any SMTP server you install has to do one of three things with the
mail you give it:

1) Accept it locally. Presumably the wrong thing to do here.
2) Deliver it to the authoritative SMTP server for the domain.
3) Deliver it to an intermediate server.

(Edit: Your next mail shows that you understand that, as looking up
the MX record is what I was going to say here.)

So if you want to avoid using an external intermediate server, you
need to find and talk to the authoritative server. Now, this is where
another big consideration comes in. What envelope From address are you
going to use? Is your own IP address allowed to send mail for that
domain? If not, you may be forced to use the legitimate server for
that domain. There are other concerns, too; if you don't have a nice
name to announce in the HELO, you might find your mail treated as
spam. But if you deal with all that, then yes, the only thing you need
to do is look up the MX record and pick the best server. (And then
deal with other concerns like coping with that one being down, which
is the advantage of having a local mail queue. But sometimes that
doesn't matter, like if you're sending to yourself for notifications.)

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Using pythons smtp server

2013-12-13 Thread Vincent Davis
Grant, Chris
Thanks !!!
I guess in the end this is a bad idea, (for my purposes) I should just use
my gmail account smtp server.

Vincent Davis
720-301-3003


On Fri, Dec 13, 2013 at 11:15 AM, Chris Angelico ros...@gmail.com wrote:

 On Sat, Dec 14, 2013 at 4:13 AM, Vincent Davis vinc...@vincentdavis.net
 wrote:
  Let me rephrase my question. I want to send an email using python but do
 not
  want to use an external service. Does python have the ability to send
 emails
  without installing additional software or using an external
 server/service?

 Any SMTP server you install has to do one of three things with the
 mail you give it:

 1) Accept it locally. Presumably the wrong thing to do here.
 2) Deliver it to the authoritative SMTP server for the domain.
 3) Deliver it to an intermediate server.

 (Edit: Your next mail shows that you understand that, as looking up
 the MX record is what I was going to say here.)

 So if you want to avoid using an external intermediate server, you
 need to find and talk to the authoritative server. Now, this is where
 another big consideration comes in. What envelope From address are you
 going to use? Is your own IP address allowed to send mail for that
 domain? If not, you may be forced to use the legitimate server for
 that domain. There are other concerns, too; if you don't have a nice
 name to announce in the HELO, you might find your mail treated as
 spam. But if you deal with all that, then yes, the only thing you need
 to do is look up the MX record and pick the best server. (And then
 deal with other concerns like coping with that one being down, which
 is the advantage of having a local mail queue. But sometimes that
 doesn't matter, like if you're sending to yourself for notifications.)

 ChrisA
 --
 https://mail.python.org/mailman/listinfo/python-list

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Using pythons smtp server

2013-12-13 Thread Chris Angelico
On Sat, Dec 14, 2013 at 5:27 AM, Vincent Davis vinc...@vincentdavis.net wrote:
 Grant, Chris
 Thanks !!!
 I guess in the end this is a bad idea, (for my purposes) I should just use
 my gmail account smtp server.

If you're sending from gmail, use whatever gmail specifies for
sending. Otherwise your mail will be seen as spoofed.

The converse of this is that, in my opinion, *every* domain should
have an SPF record and *every* mail server should check them. That
would eliminate a huge slab of forged mail, and it'd prevent some
stupid web email forms from doing the wrong thing and only finding out
that it's wrong years later.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Using pythons smtp server

2013-12-13 Thread Grant Edwards
On 2013-12-13, Vincent Davis vinc...@vincentdavis.net wrote:
 Grant, Chris
 Thanks !!!

 I guess in the end this is a bad idea, (for my purposes) I should just use
 my gmail account smtp server.

If you're going to claim the mail is from somebody@gmail.com, then
yes you should definitly send it via Gmail's SMTP server.  Doing
anything else is going to be a long, losing battle involving you
learning more about SMTP and e-mail headers than you probably want to.

If you've got your own domain (which you're using as the from
address), a static IP, and your own MX record and corresponding SMTP
server, you should be able to set things up to send mail directly.

Many years ago (like 20), I used to configure my home Linux boxes to
send mail directly to the destination SMTP server while claiming to be
from grante@my-isp's-name.com.  At first it worked fine that way.
Then about about 12-15 years ago, I started having problems with some
servers refusing my mail.  I had a static IP address with a real,
official hostname, so I set up an MX record for that hostname, and
made sure my handshaking configuration was using a hostname that
mapped back to my static IP address.  That helped for a while, but
SMTP servers continued to get more and more paranoid.  Some SMTP
servers won't accept mail from an IP if they've determined is a
residential IP address even if you do have a domain that matches the
from address, an MX record, and everything else.

Eventually, I just gave up and started routing everything through the
official SMTP server associated with the e-mail address from which I
wanted to send the mail.

-- 
Grant Edwards   grant.b.edwardsYow! I'm having a MID-WEEK
  at   CRISIS!
  gmail.com
-- 
https://mail.python.org/mailman/listinfo/python-list


Using pythons smtp server

2013-12-12 Thread Vincent Davis
I have an app that generates a file one a day and would like to email it
using pythons SMTP server.
http://docs.python.org/2/library/smtpd.html#smtpd.SMTPServer
The documentation is kinda sparse and I cant seem to find any good examples.

Basically what I want to do; when my app runs it would initiate a SMTP
server, send the attachment and shutdown the SMTP after.

Vincent Davis
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue19509] No SSL match_hostname() in ftp, imap, nntp, pop, smtp modules

2013-12-06 Thread Christian Heimes

Christian Heimes added the comment:

I'm closing this ticket. All features have been implemented and tests are 
passing, too.

I have created #19909 as a reminder for doc improvements.

--
resolution:  - fixed
stage: patch review - committed/rejected
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19509
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19509] No SSL match_hostname() in ftp, imap, nntp, pop, smtp modules

2013-12-05 Thread Christian Heimes

Christian Heimes added the comment:

The new patch splits the test into three separate test cases.

Guido, Python 3.3 doesn't have the necessary CA and server cert files. The 
files were added to 3.4 for some other tests. The patch tries to load the files 
from 3.4's test directory and falls back to local copies. You have to 
copy/delete these files to test the patch:

$ hg rm Lib/test/test_asyncio/sample.*
$ hg cp Lib/test/ssl_key.pem Lib/test/ssl_cert.pem Lib/test/pycacert.pem 
Lib/test/keycert3.pem  Lib/test/test_asyncio/

--
Added file: http://bugs.python.org/file32991/asyncio_ssl_verify2.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19509
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19509] No SSL match_hostname() in ftp, imap, nntp, pop, smtp modules

2013-12-05 Thread Guido van Rossum

Guido van Rossum added the comment:

Thanks Christian, this is almost right.  I'm uploading a patch that covers all 
bases:

- Works on Python 3.3 (TEST_HOME_DIR isn't defined there)
- Works on older Python 3.4 versions (check_hostname may not exist)
- Works on latest Python 3.4 version

--
Added file: http://bugs.python.org/file32996/asyncio_ssl_verify3.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19509
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19509] No SSL match_hostname() in ftp, imap, nntp, pop, smtp modules

2013-12-05 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 1605eda93392 by Christian Heimes in branch 'default':
Issue #19509: Finish implementation of check_hostname
http://hg.python.org/cpython/rev/1605eda93392

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19509
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19509] No SSL match_hostname() in ftp, imap, nntp, pop, smtp modules

2013-12-05 Thread Guido van Rossum

Guido van Rossum added the comment:

With the latest (revision 1605eda93392) I get four failures on OS X.  Three are 
like this (in all three selector types -- kqueue, select, poll):

==
ERROR: test_create_ssl_connection (test_events.SelectEventLoopTests)
--
Traceback (most recent call last):
  File tests/test_events.py, line 532, in test_create_ssl_connection
tr, pr = self.loop.run_until_complete(f)
  File /Users/guido/tulip/asyncio/base_events.py, line 177, in 
run_until_complete
return future.result()
  File /Users/guido/tulip/asyncio/futures.py, line 221, in result
raise self._exception
  File /Users/guido/tulip/asyncio/tasks.py, line 276, in _step
result = coro.throw(exc)
  File /Users/guido/tulip/asyncio/base_events.py, line 388, in 
create_connection
yield from waiter
  File /Users/guido/tulip/asyncio/futures.py, line 320, in __iter__
yield self  # This tells Task to wait for completion.
  File /Users/guido/tulip/asyncio/tasks.py, line 329, in _wakeup
value = future.result()
  File /Users/guido/tulip/asyncio/futures.py, line 221, in result
raise self._exception
  File /Users/guido/tulip/asyncio/selector_events.py, line 618, in 
_on_handshake
self._sock.do_handshake()
  File /usr/local/lib/python3.4/ssl.py, line 748, in do_handshake
self._sslobj.do_handshake()
ssl.SSLEOFError: EOF occurred in violation of protocol (_ssl.c:599)

The last is similar in test_streams.py:

==
ERROR: test_open_connection_no_loop_ssl (test_streams.StreamReaderTests)
--
Traceback (most recent call last):
  File tests/test_streams.py, line 58, in test_open_connection_no_loop_ssl
reader, writer = self.loop.run_until_complete(f)
  File /Users/guido/tulip/asyncio/base_events.py, line 177, in 
run_until_complete
return future.result()
  File /Users/guido/tulip/asyncio/futures.py, line 221, in result
raise self._exception
  File /Users/guido/tulip/asyncio/tasks.py, line 276, in _step
result = coro.throw(exc)
  File /Users/guido/tulip/asyncio/streams.py, line 43, in open_connection
lambda: protocol, host, port, **kwds)
  File /Users/guido/tulip/asyncio/base_events.py, line 388, in 
create_connection
yield from waiter
  File /Users/guido/tulip/asyncio/futures.py, line 320, in __iter__
yield self  # This tells Task to wait for completion.
  File /Users/guido/tulip/asyncio/tasks.py, line 329, in _wakeup
value = future.result()
  File /Users/guido/tulip/asyncio/futures.py, line 221, in result
raise self._exception
  File /Users/guido/tulip/asyncio/selector_events.py, line 618, in 
_on_handshake
self._sock.do_handshake()
  File /usr/local/lib/python3.4/ssl.py, line 748, in do_handshake
self._sslobj.do_handshake()
ssl.SSLEOFError: EOF occurred in violation of protocol (_ssl.c:599)


I get the same failures when I copy the changes to the Tulip repo.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19509
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19509] No SSL match_hostname() in ftp, imap, nntp, pop, smtp modules

2013-12-05 Thread Guido van Rossum

Guido van Rossum added the comment:

That's fixed by revision ec1e7fc9b5a4.

Christian, can this bug be closed now, or is there more?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19509
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19509] No SSL match_hostname() in ftp, imap, nntp, pop, smtp modules

2013-12-04 Thread Guido van Rossum

Guido van Rossum added the comment:

See my messages on the review.  Is it absolutely necessary to close the socket 
when the hostname verification fails?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19509
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19509] No SSL match_hostname() in ftp, imap, nntp, pop, smtp modules

2013-12-04 Thread Roundup Robot

Roundup Robot added the comment:

New changeset b6fce698e467 by Christian Heimes in branch 'default':
Issue #19509: Don't close the socket in do_handshake() when hostname 
verification fails.
http://hg.python.org/cpython/rev/b6fce698e467

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19509
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19509] No SSL match_hostname() in ftp, imap, nntp, pop, smtp modules

2013-12-04 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 1a945fb875bf by Christian Heimes in branch 'default':
Issue 19509: Don't call match_hostname() twice in http.client.
http://hg.python.org/cpython/rev/1a945fb875bf

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19509
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19509] No SSL match_hostname() in ftp, imap, nntp, pop, smtp modules

2013-12-03 Thread Christian Heimes

Christian Heimes added the comment:

I'd rather have integration test with a real SSL connection in order to check 
the entire stack. asyncio doesn't have a test for CERT_REQUIRED yet. The 
attached patch tests three common cases: missing CA, missing server_hostname 
and a successful connection with full verification.

--
Added file: http://bugs.python.org/file32967/asyncio_ssl_verify.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19509
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19509] No SSL match_hostname() in ftp, imap, nntp, pop, smtp modules

2013-12-03 Thread Christian Heimes

Christian Heimes added the comment:

PS: The test uses keycert3.pem and pycacert.pem from the 3.4 test directory. 
keycert3.pem contains privat + public key and is signed by the CA in 
pycacert.pem.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19509
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19509] No SSL match_hostname() in ftp, imap, nntp, pop, smtp modules

2013-12-03 Thread Vajrasky Kok

Vajrasky Kok added the comment:

I left my comment on the review. I forgot to mail the review.

--
nosy: +vajrasky

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19509
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19509] No SSL match_hostname() in ftp, imap, nntp, pop, smtp modules

2013-12-02 Thread Christian Heimes

Christian Heimes added the comment:

I have addressed the five libraries in five sub-issues. http.client and 
asyncio.selector_events need small adjustments to use the new feature. Please 
review the patch.

--
nosy: +gvanrossum
Added file: http://bugs.python.org/file32940/check_hostname_adjustments.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19509
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19509] No SSL match_hostname() in ftp, imap, nntp, pop, smtp modules

2013-12-02 Thread Guido van Rossum

Guido van Rossum added the comment:

The asyncio patch looks fine, but I'd like to see a unittest that actually 
fails (or mocks failing) the hostname check where it is now performed (in 
wrap_socket() IIUC?), to make sure that the exception is propagated out 
properly.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19509
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19509] No SSL match_hostname() in ftp, imap, nntp, pop, smtp modules

2013-12-01 Thread Roundup Robot

Roundup Robot added the comment:

New changeset aa531135bc6b by Christian Heimes in branch 'default':
Issue #19509: Add SSLContext.check_hostname to match the peer's certificate
http://hg.python.org/cpython/rev/aa531135bc6b

--
nosy: +python-dev

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19509
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19509] No SSL match_hostname() in ftp, imap, nntp, pop, smtp modules

2013-11-28 Thread Christian Heimes

Christian Heimes added the comment:

My patch could be much simpler and easier if we could just drop support for 
ancient versions of OpenSSL. My idea requires at least OpenSSL 0.9.8f (release 
2007) with SNI support. Six years are a lot for crypto software. All relevant 
platforms with vendor support have a more recent version of OpenSSL, too.

 context = ssl.SSLContext(ssl.PROTOCOL_TLSv1)
 context.verify_mode = ssl.CERT_REQUIRED
 context.check_hostname = True
 context.wrap_socket(sock, server_hostname=www.example.org)

server_hostname is used to for server name indicator (SNI) as well as the 
hostname for match_hostname(). It would remove lots and lots of code 
duplication, too.

The check_hostname takes care about invalid combinations, too:

 context = ssl.SSLContext(ssl.PROTOCOL_TLSv1)
 context.verify_mode == ssl.CERT_NONE
True
 context.check_hostname = True
Traceback (most recent call last):
  File stdin, line 1, in module
ValueError: check_hostname needs a SSL context with either CERT_OPTIONAL or 
CERT_REQUIRED

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19509
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19509] No SSL match_hostname() in ftp, imap, nntp, pop, smtp modules

2013-11-28 Thread Antoine Pitrou

Antoine Pitrou added the comment:

 My patch could be much simpler and easier if we could just drop
 support for ancient versions of OpenSSL. My idea requires at least
 OpenSSL 0.9.8f (release 2007) with SNI support. 

What are you talking about? Your patch doesn't use HAS_SNI.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19509
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19509] No SSL match_hostname() in ftp, imap, nntp, pop, smtp modules

2013-11-28 Thread Christian Heimes

Changes by Christian Heimes li...@cheimes.de:


Removed file: http://bugs.python.org/file32831/check_hostname.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19509
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19509] No SSL match_hostname() in ftp, imap, nntp, pop, smtp modules

2013-11-28 Thread Christian Heimes

Christian Heimes added the comment:

The patches in the dependency tickets are using SNI. The problem is, a non-None 
server_hostname argument raises an error when OpenSSL doesn't support the 
feature.

Here is a demo patch for my idea. It makes it very easy to add hostname 
matching to existing code. All it takes is the server_hostname argument to 
wrap_socket() and a new property check_hostname for the SSLContext object. 
The rest is done in do_handshake().

--
Added file: http://bugs.python.org/file32881/sslctx_check_hostname.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19509
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19509] No SSL match_hostname() in ftp, imap, nntp, pop, smtp modules

2013-11-28 Thread Antoine Pitrou

Antoine Pitrou added the comment:

 The patches in the dependency tickets are using SNI.

They all check for HAS_SNI, which is simple enough.
If you want to discuss a minimum supported OpenSSL version, that's fine with 
me, but it should be a separate discussion (on python-dev?).

If you think your patches are not ready, then please say so, so that I don't 
review them.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19509
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19509] No SSL match_hostname() in ftp, imap, nntp, pop, smtp modules

2013-11-26 Thread Larry Hastings

Larry Hastings added the comment:

I don't know enough about SSL to make a feature vs bug/security fix ruling on 
this.  Can a second person who does--maybe Bill Janssen?--chime in?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19509
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19509] No SSL match_hostname() in ftp, imap, nntp, pop, smtp modules

2013-11-26 Thread Donald Stufft

Donald Stufft added the comment:

I agree with Christian, mail.stufft.io should not be able to masquerade as 
smtp.google.com and being able to do so is a pretty big security hole.

--
nosy: +dstufft

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19509
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19509] No SSL match_hostname() in ftp, imap, nntp, pop, smtp modules

2013-11-26 Thread Antoine Pitrou

Antoine Pitrou added the comment:

I think adding an API in bugfix releases must be an exceptional decision and 
I'm honestly not convinced this issue justifies it.
It'd be more convincing if there was actually demand for this feature (e.g. 
from higher-level library authors).

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19509
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19509] No SSL match_hostname() in ftp, imap, nntp, pop, smtp modules

2013-11-26 Thread Donald Stufft

Donald Stufft added the comment:

Probably the higher level libraries don't even realize it's not happening, it's 
similar to the issue of SSL validation for HTTPS connections where a vast 
swathe of people didn't even realize that their certificates weren't being 
validated.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19509
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19509] No SSL match_hostname() in ftp, imap, nntp, pop, smtp modules

2013-11-26 Thread Christian Heimes

Christian Heimes added the comment:

I agree with Antoine. The five attached bug reports only refer to Python 3.4.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19509
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19509] No SSL match_hostname() in ftp, imap, nntp, pop, smtp modules

2013-11-26 Thread Antoine Pitrou

Antoine Pitrou added the comment:

 Probably the higher level libraries don't even realize it's not
 happening, it's similar to the issue of SSL validation for HTTPS
 connections where a vast swathe of people didn't even realize that
 their certificates weren't being validated.

Exactly. And we didn't add certificate checking in bugfix releases in
the name of security.

Now I appreciate that it would be a bit of a pity to wait for 3.5 to add
this, so perhaps Larry wants to make an exception to the 3.4 feature
freeze so that this feature can come in (assuming Christian's patch is
ready).

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19509
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19509] No SSL match_hostname() in ftp, imap, nntp, pop, smtp modules

2013-11-26 Thread Georg Brandl

Georg Brandl added the comment:

For a true security fix, the default for check_hostname would have to be True.  
However, that will create a lot of backward compatibility problems for 
questionable gain.

I think Larry should make an exception for 3.4 and allow this new feature.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19509
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19509] No SSL match_hostname() in ftp, imap, nntp, pop, smtp modules

2013-11-26 Thread Larry Hastings

Larry Hastings added the comment:

Okay, you have my permission to add match_hostname() and fix the security hole 
you cite.  Can you have it done soon, so it can bake for a while in trunk 
before we cut beta 2?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19509
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19509] No SSL match_hostname() in ftp, imap, nntp, pop, smtp modules

2013-11-26 Thread Antoine Pitrou

Changes by Antoine Pitrou pit...@free.fr:


--
stage: needs patch - patch review
versions:  -Python 3.2, Python 3.3

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19509
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19509] No SSL match_hostname() in ftp, imap, nntp, pop, smtp modules

2013-11-26 Thread Donald Stufft

Donald Stufft added the comment:

I assumed we were talking about 3.4 and didn't even notice that the issues had 
3.3 and 3.2 attached to it.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19509
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19509] No SSL match_hostname() in ftp, imap, nntp, pop, smtp modules

2013-11-25 Thread Christian Heimes

Christian Heimes added the comment:

The patch implements check_hostname in order to match SSL certs with the peer's 
hostname in ftp, imap, nntp, pop and smtp library. So far the patch needs more 
tests and doc updates.

I consider the new feature a security fix. Right now everybody with any valid 
TLS/SSL certificate can claim that its certificate is valid for 
'smtp.google.com'.

--
keywords: +patch
nosy: +georg.brandl, larry
Added file: http://bugs.python.org/file32831/check_hostname.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19509
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19509] No SSL match_hostname() in ftp, imap, nntp, pop, smtp modules

2013-11-25 Thread Christian Heimes

Changes by Christian Heimes li...@cheimes.de:


--
dependencies: +No SSL match_hostname() in ftplib, No SSL match_hostname() in 
imaplib, No SSL match_hostname() in nntplib, No SSL match_hostname() in poplib, 
No SSL match_hostname() in smtplib

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19509
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19509] No SSL match_hostname() in ftp, imap, nntp, pop, smtp modules

2013-11-25 Thread Arfrever Frehtes Taifersar Arahesis

Changes by Arfrever Frehtes Taifersar Arahesis arfrever@gmail.com:


--
nosy: +Arfrever

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19509
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



  1   2   3   4   5   >