here is my code:
import smtplib
from email import encoders
from email.mime.text import MIMEText
from email.mime.base import MIMEBase
from email.mime.multipart import MIMEMultipart
server = smtplib.SMTP('smtp.gmail.com', 25)
server.ehlo()
with open('password.txt', 'r') as f:
password = f.read()
server.login('bjdawson1012@gmail.com', password)
msg = MIMEMultipart()
msg['from'] = 'BenDawson'
msg['To'] = 'bdawsonceo@gmail.com'
msg['Subject'] = 'DawsonUTV'
with open('message.txt', 'r') as f:
message = f.read()
msg.attach(MIMEText(message, 'plain'))
filename = 'baldksi.jpg'
attachment = open(filename, 'rb')
p = MIMEBase('application', 'octet-stream')
p.set_payload(attachment.read())
encoders.encode_base64(p)
p.add_header('Content-Disposition', f'attachment; filename ={filename}')
msg.attach(p)
text = msg.as_string()
server.sendmail('bjdawson1012@gmail.com', 'bdawsonceo@gmail.com', text)
here are my errors:
Traceback (most recent call last):
File "c:\Users\hp\Desktop.py\Python Code Bank\networks, FCC YT\mailing client.py", line 15, in
server.login('bjdawsonxxxx@gmail.com', password)
File "C:\Users\hp\AppData\Local\Programs\Python\Python39\lib\smtplib.py", line 711, in login
raise SMTPNotSupportedError(
smtplib.SMTPNotSupportedError: SMTP AUTH extension not supported by server.
PS C:\Users\hp\Desktop.py\Python Code Bank\networks, FCC YT>
thanks in advance :)