Trailing whitespaces are best avoided.
Setting namelen could have no effect, my guess is that this was the original intention of the code. This results in more efficient usage of lines.
An update to yesterday's patch. Should avoid copying the mail byte string more than once. Tested on Python 2.7 and 3.6.