Skip to content

Email notification

Q-engineering edited this page Sep 27, 2023 · 3 revisions

👉 If you use our image it's already installed.

We use Gmail as it can forward your emails to any other address.


If you like to install this email engine on another RPi, here are the steps.

$ sudo apt-get install mutt

Less secure apps

Before you can send an email to any address, you must register your app with Google. The Raspberry Pi does not meet all of Google's security requirements. To better protect your Google account from hackers, the Raspberry Pi gets its own unique password. With this password, it can only send emails to Gmail, not open your entire Google account.

First, check if you enabled the 2-Step Verification when you log in to your Google account. Without 2-Step Verification, Google will not generate the needed password.

output image

The next step is to generate the password by giving the Raspberry Pi an appropriate name, here YoloCam. Let the images speak for themselves.

output image
output image
output image
output image
output image
Your password must be entered in the ~/.mutt/muttrc file. By the way, the used gbxcthxuwxppxoxh is just an example.

mutt

$ mkdir -p ~/.mutt/cache/headers
$ mkdir ~/.mutt/cache/bodies
$ touch ~/.mutt/certificates
$ touch ~/.mutt/muttrc
$ sudo nano ~/.mutt/muttrc
set from = "username@gmail.com"
set realname = "YoloIP camera"

# SMTP settings
set smtp_url = "smtps://username@smtp.gmail.com"
set smtp_pass = "<mailbox password>"

# Remote Gmail folders
set folder = "imaps://imap.gmail.com/"
set spoolfile = "+INBOX"
set postponed = "+[Gmail]/Drafts"
set trash = "+[Gmail]/Trash"

# Mailbox location in RAM
set record = "/dev/shm/sent"

# Sending HTML mails
set content_type = "text/html"

output image

Close with <Ctrl>+<X>, <Y>, <Enter>.

Now you can test the connection with the next command:

mutt -s "My Title" - johndoe123@his_mail.us < ./body.html

Of course, you have to replace johndoe123@his_mail.us with your own email address.

Clone this wiki locally