import smtplib
|
|
from email.mime.text import MIMEText
|
|
|
|
|
|
MAIL_SERVER= 'smtp.gmail.com'
|
|
MAIL_PORT=587
|
|
MAIL_USERNAME='devesaparkpadel@gmail.com'
|
|
MAIL_PASSWORD='mzgvprepqhlkuxgy'
|
|
MAIL_USE_TLS='True'
|
|
MAIL_USE_SSL='False'
|
|
# Configuration
|
|
|
|
#sender_email = MAIL_USERNAME
|
|
sender_email = 'devesaparkpadel@gmail.com'
|
|
receiver_email = "creylopez@yahoo.es"
|
|
|
|
# Plain text content
|
|
text = """\
|
|
Hi,
|
|
Check out the new post on the Mailtrap blog:
|
|
SMTP Server for Testing: Cloud-based or Local?
|
|
https://blog.mailtrap.io/2018/09/27/cloud-or-local-smtp-server/
|
|
Feel free to let us know what content would be useful for you!
|
|
"""
|
|
|
|
# Create MIMEText object
|
|
message = MIMEText(text, "plain")
|
|
message["Subject"] = "Plain text email"
|
|
message["From"] = sender_email
|
|
message["To"] = receiver_email
|
|
|
|
# Send the email
|
|
with smtplib.SMTP(MAIL_SERVER, MAIL_PORT) as server:
|
|
server.starttls() # Secure the connection
|
|
server.set_debuglevel(1)
|
|
server.login(MAIL_USERNAME, MAIL_PASSWORD)
|
|
server.sendmail(sender_email, receiver_email, message.as_string())
|
|
|
|
print('Sent')
|