# import the necessary components first import smtplib from email.mime.text import MIMEText from email.mime.multipart import MIMEMultipart port = 587 smtp_server = "MailServer" login = "Name@MailServer" # paste your login password = "MailPassword" # paste your password sender_email = "Name@MailServer" receiver_email = "Name@MailServer" message = MIMEMultipart("alternative") message["Subject"] = "Horde Vuln Test" message["From"] = sender_email message["To"] = receiver_email # write the text/plain part text = """This is a Horde Vulnerability test email.""" # write the HTML part html="""
This is a Horde Vulnerability test email. HTML format.
"""
# convert both parts to MIMEText objects and add them to the MIMEMultipart message
part1 = MIMEText(text, "plain")
part2 = MIMEText(html, "html")
message.attach(part1)
message.attach(part2)
# send your email
with smtplib.SMTP(smtp_server, port) as server:
server.login(login, password)
server.sendmail(
sender_email, receiver_email, message.as_string()
)
print('Sent')