This document aims to show how to use yagmail in your programs.
Most of what is shown here is also available to see in the
README, some content may be
duplicated for completeness.
Start a Connection
As mentioned in Configuring Credentials, there
are three ways to initialize a connection by instantiating
1. With Username and Password:
e.g. yagmail.SMTP(‘mygmailusername’, ‘mygmailpassword’)
This method is not recommended, since you would be storing
the full credentials to your account in your script in plain text.
A better alternative is using keyring, as described in the
2. With Username and keyring:
After registering a keyring entry for yagmail, you can
instantiate the client by simply passing your username, e.g.
3. With keyring and .yagmail:
As explained in the Setup documentation, you can also
omit the username if you have a .yagmail file in your
home folder, containing just your GMail username. This way,
you can initialize yagmail.SMTP without any arguments.
4. With OAuth2:
This is probably the safest method of authentication, as you
can revoke the
Original URL: http://feedproxy.google.com/~r/feedsapi/BwPx/~3/IBqeey_ZUdc/usage.html