1

So I'm about ready to pull my hair out on this one. I am running ssmtp and mutt on a freeBSD jail. I have a bash script called notify that contains the following line.

mutt -s "$subject" "$email" -a "$attachment" < "$logfile3"

When I run

bash notify.sh

The email will send just fine, but if I run that exact same command from inside motioneye I receive an extremely non-descript error from mutt enter image description here

Could not send the message

I have tried using a daemon but that hasn't had any effect. I wish the mutt error message was more descriptive.

Darpeh
  • 86
  • 7
  • 1
    It could be your PATH variable. In notify.sh, near the top, add the debug line: `echo "$PATH" > /tmp/notify.debug.$$`. Then run notify.sh manually, and run it again under motioneye. Compare the two /tmp/notify.debug.* files and see if they have the same path. – Jim L. Feb 25 '19 at 23:53
  • Outside: `/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/root/bin` Inside: (I'll update this when I get home and can trigger the camera) – Darpeh Mar 06 '19 at 15:10
  • Inside: `/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/root/bin` The paths are identical so that's not it. – Darpeh Mar 06 '19 at 15:17

2 Answers2

1

My script did not have access to the "sent" mailbox and therefore mutt was failing to send. -e "set copy=no" added to the mutt call corrected the issue.

For a better walkthrough: https://gitlab.com/muttmua/mutt/issues/119

Darpeh
  • 86
  • 7
0

Make sure you have bash installed (it isn't by default on FreeBSD) and try using absolute path to it (/usr/local/bin/bash).

arrowd
  • 33,231
  • 8
  • 79
  • 110
  • Bash is installed and running on both commandine and the script itself. All other aspects of notify.sh function just fine. – Darpeh Feb 04 '19 at 12:36