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

Sending smtp with starttls #254

Open
AugustasVol opened this issue Sep 13, 2022 · 4 comments
Open

Sending smtp with starttls #254

AugustasVol opened this issue Sep 13, 2022 · 4 comments

Comments

@AugustasVol
Copy link

It works perfectly when sending emails with SSL, however, when I try to send with STARTTLS it does not work and the docs do not state how to do it.

It would be great if the docs could be updated on SMTP sending because yagmail is the best way to send emails in python.

@kootenpv
Copy link
Owner

Were you able to ultimately make it work? I do remember looking at starttls at some point... But don't remember details

@AugustasVol
Copy link
Author

AugustasVol commented Sep 14, 2022

No, I haven't. I really don't know what to do to enable the starttls.

I did:
help(yagmail.SMTP)
Got:

SMTP(user=None, password=None, host='smtp.gmail.com', port=None, smtp_startt
ls=None, smtp_ssl=True, smtp_set_debuglevel=0, smtp_skip_login=False, encoding='
utf-8', oauth2_file=None, soft_email_validation=True, dkim=None, **kwargs)

So there is an option to do something with smtp_starttls, however I have no idea what to pass to it.
Should I pass something from the smtplib?

@kootenpv
Copy link
Owner

It's used like this:

def starttls(self):
    if self.smtp_starttls is None:
        return False if self.ssl else True
    return self.smtp_starttls

so basically if you don't provide anything and ssl=True then it is False

you can explicitly pass False or True yourself

@AugustasVol
Copy link
Author

I see, thank you.

I'll try it and report back if this works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants