Here’s how you can quickly send an email with Gmail using the Yagmail library:
- Install Yagmail by running the command
pip install yagmail
in your shell. - Install Keyring by running the command
pip install keyring
in your shell. - Execute the following code snippet (specify your own username, password, and email content):
import yagmail yag = yagmail.SMTP('username', 'password') yag.send(to = 'receiver@email.com', subject = 'hi', contents = 'Just wanted to say "hi"')
VoilΓ . You can consult the README to find out about more features such as sending HTML messages.