<reponame>Roger-Takeshita/Python-Course
import smtplib
from email.message import EmailMessage
from string import Template
from pathlib import Path

name = 'Yumi'
html = Template(Path('email_send.html').read_text())
email = EmailMessage()
email['From'] = '<NAME>'
email['To'] = '<EMAIL>'
email['Subject'] = f'It\'s your lucky day {name}'
email.set_content(html.substitute({'name': name}), 'html')

with smtplib.SMTP(host='smtp.gmail.com', port=587) as smtp:
    smtp.ehlo()
    smtp.starttls()
    smtp.login('<EMAIL>', '<PASSWORD>')
    smtp.send_message(email)
    print('message sent')
import smtplib
from email.message import EmailMessage
from string import Template
from pathlib import Path

name = 'Yumi'
html = Template(Path('email_send.html').read_text())
email = EmailMessage()
email['From'] = '<NAME>'
email['To'] = '<EMAIL>'
email['Subject'] = f'It\'s your lucky day {name}'
email.set_content(html.substitute({'name': name}), 'html')

with smtplib.SMTP(host='smtp.gmail.com', port=587) as smtp:
    smtp.ehlo()
    smtp.starttls()
    smtp.login('<EMAIL>', '<PASSWORD>')
    smtp.send_message(email)
    print('message sent')