Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

smtplip STARTTLS fails at second attampt due to unsufficiant quit() #66412

Closed
zvyn mannequin opened this issue Aug 17, 2014 · 2 comments
Closed

smtplip STARTTLS fails at second attampt due to unsufficiant quit() #66412

zvyn mannequin opened this issue Aug 17, 2014 · 2 comments
Labels
stdlib Python modules in the Lib dir topic-email type-bug An unexpected behavior, bug, or error

Comments

@zvyn
Copy link
Mannequin

zvyn mannequin commented Aug 17, 2014

BPO 22216
Nosy @warsaw, @bitdancer, @zvyn
Files
  • quit_resets_greeting.patch
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2014-08-30.20:59:23.058>
    created_at = <Date 2014-08-17.16:53:45.166>
    labels = ['type-bug', 'library', 'expert-email']
    title = 'smtplip STARTTLS fails at second attampt due to unsufficiant quit()'
    updated_at = <Date 2014-08-30.20:59:23.057>
    user = 'https://github.com/zvyn'

    bugs.python.org fields:

    activity = <Date 2014-08-30.20:59:23.057>
    actor = 'r.david.murray'
    assignee = 'none'
    closed = True
    closed_date = <Date 2014-08-30.20:59:23.058>
    closer = 'r.david.murray'
    components = ['Library (Lib)', 'email']
    creation = <Date 2014-08-17.16:53:45.166>
    creator = 'zvyn'
    dependencies = []
    files = ['36396']
    hgrepos = []
    issue_num = 22216
    keywords = ['patch']
    message_count = 2.0
    messages = ['225450', '226150']
    nosy_count = 3.0
    nosy_names = ['barry', 'r.david.murray', 'zvyn']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue22216'
    versions = ['Python 3.4', 'Python 3.5']

    @zvyn
    Copy link
    Mannequin Author

    zvyn mannequin commented Aug 17, 2014

    When using smtplib.SMTP to connect to a SMTP server the instance variables esmtp_response survives a SMTP.quit() which results in the following error:

    >>> import smtplib
    >>> smtp = smtplib.SMTP('mail.oberkirch.org', 25)
    >>> smtp.starttls()
    (220, b'2.0.0 Ready to start TLS')
    >>> smtp.ehlo()
    (250, b'mail.oberkirch.org\nPIPELINING\nSIZE 10240000\nVRFY\nETRN\nAUTH PLAIN LOGIN\nAUTH=PLAIN LOGIN\nENHANCEDSTATUSCODES\n8BITMIME\nDSN')
    >>> smtp.quit()
    (221, b'2.0.0 Bye')
    >>> smtp.connect('mail.oberkirch.org', 25)
    (220, b'mail.oberkirch.org ESMTP Postfix')
    >>> smtp.starttls()
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "/usr/lib/python3.4/smtplib.py", line 672, in starttls
        raise SMTPException("STARTTLS extension not supported by server.")
    smtplib.SMTPException: STARTTLS extension not supported by server.
    >>>

    While reporting this issue I found out that starttls also does not throw away any ehlo information as it should. Provided that fixing this would probably break existing code (which would only work with non-standard servers like postfix) I did not change that behaviour.

    @zvyn zvyn mannequin added stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error labels Aug 17, 2014
    @bitdancer
    Copy link
    Member

    Thanks, Milan.

    I could swear I typed a '6' in the commit message, but apparently not...

    New changeset a058760cb069 by R David Murray in branch '3.4':
    bpo-22215: have the smtplib 'quit' command reset the state.
    http://hg.python.org/cpython/rev/a058760cb069

    New changeset d0d4ab0ba70e by R David Murray in branch 'default':
    Merge bpo-22215: have the smtplib 'quit' command reset the state.
    http://hg.python.org/cpython/rev/d0d4ab0ba70e

    New changeset 7288519594de by R David Murray in branch '2.7':
    bpo-22215: have the smtplib 'quit' command reset the state.
    http://hg.python.org/cpython/rev/7288519594de

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    stdlib Python modules in the Lib dir topic-email type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant