Here’s how you can quickly send an email with Gmail using the Yagmail library:
- Install Yagmail by running the command
pip install yagmailin your shell.
- Install Keyring by running the command
pip install keyringin 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 = 'email@example.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.