#๐ SMTP Auth extension not supported
23 messages ยท Page 1 of 1 (latest)
@woven haven
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.
read this please
yeah
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
iirc you needed to use the google api in order to send emails with gmail
you can no longer use username and password
iirc?
if i remember correctly
I can't help with this then :p
https://developers.google.com/gmail/api/guides try using this tho
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.