I wrote a step-by-step guide on sending email from a Raspberry Pi using msmtp + Gmail OAuth2 (no app passwords).
Covers:
- Setting up msmtp on Raspberry Pi
- Configuring Gmail OAuth2
- Generating and using access tokens
- Sending test emails from scripts
The goal was to enable a Raspberry Pi to send automated emails through Gmail despite Google blocking “less secure apps,” by using msmtp with OAuth 2.0 so that scripts, alerts, and notifications continue to work securely without relying on app passwords.
Full guide (with configs + commands):
https://linsnotes.com/posts/sending-email-from-raspberry-pi-using-msmtp-with-gmail-oauth2/
Would appreciate any feedback or improvements—especially if you’ve done this differently (e.g. other mail setups, providers, or better token handling).
Top comments (0)