Project

General

Profile

Bug #13971

SMTP mailing TLS not working

Added by Branislav Kirilov over 4 years ago. Updated about 4 years ago.

Status:
Closed: Behaves correctly
Priority:
Nice to have
Assignee:
-
Category:
OS
Target version:
Severity:
New
Reason for Closing:
Reason for Blocked:
Needs QA:
Yes
Needs Doc:
Yes
Needs Merging:
Yes
Needs Automation:
No
Support Suite Ticket:
n/a
Hardware Configuration:

not relevant

ChangeLog Required:
No

Description

Bug is in python smtplib and it's about the library not trying all possible login methods. It goes only with cram md5. Sending mail through gmail does not work. I managed to catch it by trying with own mail server, which refused login with cram md5 method.

I managed to fix it in /usr/local/lib/python2.7/smtplib.py

by changing default
preferred_auths = [AUTH_CRAM_MD5, AUTH_PLAIN, AUTH_LOGIN]

to
preferred_auths = [AUTH_LOGIN, AUTH_CRAM_MD5, AUTH_PLAIN]

Mail starts working.

History

#1 Updated by Jordan Hubbard over 4 years ago

Hmm. According to the python documentation for this (both in 2.7 and 3.4), this is deliberate as the login auth is considered "weaker" (perhaps when SSL is not used in conjunction with it). It's interesting that you're also the first person to report this issue, since it should really "fail downwards" in the preferred_auths list, it shouldn't just try CRAM_MD5 and then give up. Are you sure everything else in your mail configuration is correct?

#2 Updated by Branislav Kirilov over 4 years ago

  • Hardware Configuration updated (diff)

Well my email setup is pretty straightforward. Username, pass, TLS, port 587.
I tried and got Authentication failed. Then i decided to try with gmail, if for some reason my mail server was the trouble. Then again i got the Authentication error.
Then decided to look more closely and found it.
If it should try CRAM_MD5 and give up, then there isn't a bug, but i don't think that this should be the normal behavior. Check this patch in smtplib https://bugs.python.org/issue6683

#3 Updated by Jordan Hubbard over 4 years ago

  • Assignee set to Erin Clark
  • Target version set to Unspecified

#4 Updated by Erin Clark over 4 years ago

  • Status changed from Unscreened to Screened

#5 Updated by Jordan Hubbard over 4 years ago

  • Assignee changed from Erin Clark to Anonymous
  • Priority changed from No priority to Nice to have

Kaustubh, please investigate interoperability with gmail.

#6 Updated by Anonymous over 4 years ago

Setting up 9.3.1 environment to reproduce this.
Will investigate and update on this once done.

#7 Updated by Anonymous over 4 years ago

  • Status changed from Screened to Closed: Behaves correctly

I face no issues sending mail through gmail with both SSL/TLS. I had to allow less secure apps on gmail though.

@Branislav: Kindly check if you have allowed less secured apps on gmail.
https://www.google.com/settings/security/lesssecureapps

Turning off the less secured apps I get this error:
"Your test email could not be sent: (535, '5.7.8 Username and Password not accepted. Learn more at\n5.7.8 https://support.google.com/mail/answer/14257 o7sm9587590pfa.37 - gsmtp')",
not the authentication error irrespective of 'preferred_auths' sequence.

For more info:
https://support.google.com/accounts/answer/6010255?hl=en

#8 Avatar?id=14398&size=24x24 Updated by Kris Moore about 4 years ago

  • Target version changed from Unspecified to N/A

Also available in: Atom PDF