Setting up OctoPi (OctoPrint) with Email Notifier yagmail

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

  1. Login to your raspberrypi using SSH. I use Bitvise SSH for all my SSH needs.
  2. 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
    import yagmail
    yagmail.register('', 'yourpassword')
  3. 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 ...>
  4. Install “Email Notifier” through the OctoPrint web interface if you haven’t already.
  5. 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.

How to move OcotoPi (OctoPrint on Raspberry Pi 3+) to a new Network

If you’re renaming your network or taking your OctoPi & Printer on the road you may need to change the name and credentials of the Wifi network to work. It’s not hard to do but you will need to connect to the Raspberry Pi console directly. This is when having the Raspberry PI LCD screen comes in really handy.

Once you’re looking at the Raspberry Pi console the network setup file is in

sudo nano /boot/octopi-network.txt

You will recognize this file from initial setup. Just change the name and password to the new network and reboot.