Good day
I'm trying to send a simple email with a subject and body but I get this error, How do I get rid of it The error...
socket.gaierror: [Errno 11002] getaddrinfo failed
The code...
import smtplib
from email.message import EmailMessage
import ssl
email_sender = 'msaysigcau@gmail.com'
email_password = '___'
email_receiver = 'siphosoxolos70@gmail.com'
subject = ' Hi this is a python test'
body = """ This is me testing my emails """
em = EmailMessage()
em['from'] = email_sender
em['To'] = email_receiver
em['subject'] = subject
em.set_content(body)
context = ssl.create_default_context()
with smtplib.SMTP_SSL('smtp.gmail.com', 465, context=context) as smtp:
smtp.login(email_sender, email_receiver, em.as_string())