#๐Ÿ”’ SMTP Auth extension not supported

23 messages ยท Page 1 of 1 (latest)

woven haven
#

Hi i am trying to send an email via python but it, doesn't let me login to the smtp server, i have got the app password, passing through the correct parameters but I am getting this error, it was working fine earlier

zenith cipherBOT
#

@woven haven

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

knotty pebble
woven haven
#

mb lemme send my code

#

should i remove the app pswd?

knotty pebble
#

yeah

woven haven
#
import smtplib
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
from email.mime.base import MIMEBase
from email import encoders

smtp_port = 587
smtp_server = "smtp.gmail.com"

email_from = 'themeailsendfrom'
email_to = 'theemailsentto'

pswd = 'thereissmtnhere'
subject = "Unauthroised Personal Detected!"
def send_emails(email_to):
    body = """
    Intruder has been detected!
    """

    msg = MIMEMultipart()
    msg['From'] =  email_from
    msg['To'] =  email_to
    msg['Subject'] = subject

    msg.attach(MIMEText(body, 'plain'))

    filename = 'faces\Elon.png'

    attachment = open(filename, 'rb')

    attachment_package = MIMEBase('application', 'octet-stream')
    attachment_package.set_payload((attachment).read())
    encoders.encode_base64(attachment_package)
    attachment_package.add_header('Content-Disposition', "attachment; filename= " + filename)
    msg.attach(attachment_package)

    text = msg.as_string()

    print("Connection to server...")
    TIE_server = smtplib.SMTP(smtp_server, smtp_port)
    TIE_server.starttls
    print(pswd, email_from)
    TIE_server.login(email_from, pswd)
    print("Connected to the Server!")
    print()

    print(f'Sending Email to {email_to}')
    TIE_server.sendmail(email_from, email_to, text)
    print(f'Email sent to: {email_to}')
    print()


    TIE_server.quit()

send_emails(email_to)```
#

so im trying to attach the file elon.png into the email and send that off

#

when i have it in plain text it lets me do it fine

#

as in sending without the attachment

knotty pebble
#

iirc you needed to use the google api in order to send emails with gmail

#

you can no longer use username and password

woven haven
#

iirc?

knotty pebble
#

if i remember correctly

woven haven
#

it was working fine when i was sending just text over in the body

#

so it did login

knotty pebble
#

I can't help with this then :p

woven haven
#

it just started working didnt change anything

#

what the

#

!close

zenith cipherBOT
#
Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.