Skip to content

Instantly share code, notes, and snippets.

@rahim42324
Last active October 30, 2020 13:51
Show Gist options
  • Select an option

  • Save rahim42324/1012b3f567507a9405d1ca2a535ce1d0 to your computer and use it in GitHub Desktop.

Select an option

Save rahim42324/1012b3f567507a9405d1ca2a535ce1d0 to your computer and use it in GitHub Desktop.
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
mail_content = 'This is a simple mail'
#The mail addresses and password
sender_address = 'sender123@gmail.com'
sender_pass = 'xxxxxxxx'
receiver_address = 'receiver567@gmail.com'
#Setup the MIME
message = MIMEMultipart()
message['From'] = sender_address
message['To'] = receiver_address
message['Subject'] = 'A test mail sent by Python. It has an attachment.' #The subject line
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment