DigitalOcean notes

From raju

referral link

If you sign up to a digital ocean account using , you get $10 and I get $25. Go ahead and make me rich! ;)

using to send emails from a digitalocean droplet

Create a config file

    $ cat
    fromaddr = ""
    password = "bar"
    toaddr = ""

Restrict the permissions on it as it contains your password.

    $ chmod 600

Basic script to send emails

    $ cat
    import smtplib
    import config
    server = smtplib.SMTP("", 587)
    server.login(config.fromaddr, config.password)
    msg = "Subject: Be nice.\nSome nice msg."
    server.sendmail(config.fromaddr, config.toaddr, msg)

Send email

    $ python3 ./

This will fail for the first time with an SMTPAuthenticationError exception.

Now login into the config.fromaddr gmail account -> open the email from Google with Subject "Review blocked sign-in attempt" -> click link under "allowing access to less secure apps" -> set "Allow less secure apps:" to ON

If this is successful, google will send a new email with Subject "Access for less secure apps has been turned on".

Now go to -> click the "Continue" to "Allow access to your Google account"

Now, if you run the python program again, it should run successfully and send an email to the config.toaddr in the config file.