gammaradiation999
Posts: 2
Joined: Wed Apr 09, 2014 9:35 pm

mpack mail and attachment not loaded

Wed Apr 09, 2014 10:01 pm

Hi all,

I am running raspberry pi and raspbian with a logitech webcamera and the software motion, installed via apt-get install motion.It saves my pictures to a folder on the sd card but in motion.conf I have enabled

Code: Select all

on_picture_save mpack -s "Alert" /home/pi/pictures/%f recipient@gmail.com
However no email with/or without attachment gets sent automatically by motion as it is supposed to.
Since I can send the photos manually via

Code: Select all

mpack -s "Alert" /home/pi/pictures/filename recipient@gmail.com
the configuration of the email-client ssmtp seems ok, so I guess the error is related to the motion-config.
Observing:

Code: Select all

cat /etc/passwd | grep motion
motion:x:107:110:/home/motion:/bin/false
lead me to guess user motion has insufficient permissions but executing

Code: Select all

sudo usermod -s /bin/bash motion

and then rerunning motion does not make any difference, i.e still no email with attachment is sent..
Does anybody have an idea what could be wrong?
regards
tim

Pi_R_Square
Posts: 1
Joined: Thu Aug 22, 2019 3:08 am

Re: mpack mail and attachment not loaded

Thu Aug 22, 2019 3:18 am

This may help...

since mpack uses mail, I'd recommend testing mail directly, and not mpack.
su to root, and run your test with mail only.
If it fails, then your msmtp or ssmtp is likely using a config that root can't get to...

Example:
Since Raspberry Pi Buster, ssmtp is deprecated, so I switched to msmtp.
I ran a test from the pi user, and it works fine, I tried with root, and mail failed...

Since motion runs as root, motion is not able to send mail.

Solution: msmtp allows either local configs ~/.msmtprc OR a global config for all users at /etc/msmtprc
Use the global config for mail, and not the user specific one, and it works as expected, or setup root to have a .msmtprc config as well.

Keywords: motion.conf, mpack, msmtp, msmtprc, mail failed

Return to “Troubleshooting”