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

tlsv1 unrecognized name (_ssl.c:600) when setting up with gmail #66

Closed
jerrygaoLondon opened this issue Jul 1, 2016 · 3 comments
Closed
Labels
1.bug An error has been encountered that is preventing utilization. meta:duplicate This issue or pull request already exists. org:external Issue identified with upstream dependency. transport:smtp

Comments

@jerrygaoLondon
Copy link

Following the example code, i'm trying to setup marrow.mailer with gmail. There is no indication for any failure. But, after debugging, it actually throws [SSL: TLSV1_UNRECOGNIZED_NAME] tlsv1 unrecognized name (_ssl.c:600) in result

My code is as follows:

    import logging
    from marrow.mailer import Message, Mailer
    logging.basicConfig(level=logging.DEBUG)

    mail = Mailer({
        'manager.use': 'futures',
        'transport.use': 'smtp',
        'transport.host': 'smtp.gmail.com',
        'transport.port': '587',
        'transport.tls': 'required',
        'transport.username': '<MY_USERNAME>@gmail.com',
        'transport.password': '<MY_PASSWORD>',
        'transport.max_messages_per_connection': 5,
        'transport.debug': 'True'
    })
    mail.start()

    message = Message([('recipient 1', '<recipient1_email_address>')],
                      [('recipient 2', '<recipient1_email_address>')],
                      "This is a test message.", plain="Testing!")

    result = mail.send(message)
    mail.stop()

With exactly same setting, using smtplib works well.

@nashley
Copy link

nashley commented Aug 11, 2017

Did you end up making progress on this?

Looks like this might have something to do with SNI.

Unfortunately, smtplib is becoming a lot easier to use, so I'm going to migrate to that until this is fixed.

@kobzar
Copy link

kobzar commented May 17, 2019

You can fix it very simple.
Just edit you local copy of marrow.mailer transport/smtp.py
row 74
from
connection = SMTP(local_hostname=self.local_hostname, timeout=self.timeout)
to
connection = SMTP(host=self.host, port=self.port, local_hostname=self.local_hostname, timeout=self.timeout)

And
row 84
from
connection.starttls(self.keyfile, self.certfile)
to
connection.starttls()

Reaaly, U can make changes more effective for you. But this code show an idea for U.

@amcgregor amcgregor added 1.bug An error has been encountered that is preventing utilization. transport:smtp meta:duplicate This issue or pull request already exists. org:external Issue identified with upstream dependency. labels Oct 5, 2023
@amcgregor
Copy link
Member

amcgregor commented Oct 5, 2023

Closing as… "won't fix"? "Already fixed?" "Upstream issue, not my problem?"

See the discussion on #83 and the associated (rejected) pull requests. This "fix", while seemingly required until CPython fix their ████, suffers a notable disadvantage. It is, however, conditionally applied in situations where it is required in my downstream work branch:

marrow/mailer/transport/smtp.py

Applying this fix will immediately attempt to connect on instantiation, not first use, and prevents the assignment of a debug level for diagnostic use prior to that attempt to connect. It's a "fix, with defects," which made those PRs unacceptable.

With slack time to update my projects, this fix will get incorporated "Real Soon Now™", once I get a chance to finish off modernized Python 3 packaging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1.bug An error has been encountered that is preventing utilization. meta:duplicate This issue or pull request already exists. org:external Issue identified with upstream dependency. transport:smtp
Projects
None yet
Development

No branches or pull requests

4 participants