I found a few guides to this on the internet but none of them worked for me out of the box using the latest (as of today) Octopi image and a Raspberry Pi 3. What I did eventually get to work was the following
- Login to your raspberrypi using SSH. I use Bitvise SSH for all my SSH needs.
- Run a few commands to make sure your octoprint is setup correctly. The explanation for the lines is as follows. Activate octoprint environment -> install yagmail (probably already installed) -> install keyrings.alt which is needed by yagmail -> activate python -> run the yagmail registration command
source ~/oprint/bin/activate pip install yagmail pip install keyrings.alt python import yagmail yagmail.register('email@example.com', 'yourpassword')
- While you’re here do a test run to make sure you can connect (this will only work for Gmail SMTP servers. It’s possible to get it working with other servers but you would have to modify some source code to get the ports right. Much easier to just use Gmail)
You should get back
<yagmail.yagmail.SMTP instance at ...>
- Install “Email Notifier” through the OctoPrint web interface if you haven’t already.
- Restart your RaspberryPi – This may seem unnecessary but I highly recommend it. I ran into lots of problems with emails not sending that were fixed by a simple reboot.