Skip to content

Instantly share code, notes, and snippets.

@altafshaikh
Last active September 5, 2019 05:01
Show Gist options
  • Save altafshaikh/9f3756ac266192ccc41ad59127a159b2 to your computer and use it in GitHub Desktop.
Save altafshaikh/9f3756ac266192ccc41ad59127a159b2 to your computer and use it in GitHub Desktop.
This is a python script to send mail using gmail account.
##configuration
"""
1. Install yagmail
2. Install keyrings
3. Setup keyrings
"""
import yagmail
def send_mail(to,msg,sub):
receiver = to
body = msg
#filename = "mail.py"
sender = "your_mail_id"
yag = yagmail.SMTP(sender)
yag.send(
to=receiver,
subject=sub,
contents=body,
#attachments=filename,
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment