Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.
  • Ubuntu Jaunty Server (9.04)
  • pure-ftpd 1.0.21-11.4ubuntu1
  • mutt 1.5.18-6ubuntu1

I need to receive e-mail notifications when my FTP users upload files.

I use pure-uploadscript to do this. The code below is set to be run from my own (non-super) user:

#! /bin/bash
echo "File $1 (size $UPLOAD_SIZE) uploaded by $UPLOAD_VUSER \
on $(date)" \
| /usr/bin/mutt -s "[FTP] File uploaded: $1" \
  user@example.com 2>&1 >> path/logfile \
&& echo "OK $1 $(id)" >> path/logfile \
|| echo "ERR $1 $(id)" >> path/logfile

My script gets called, $(id) displays correct data, but mutt says (as I can see from the log) "Could not send the message.".

When I run the same command from the commandline of my own user, message is sent.

What can I do to debug this?

share|improve this question
add comment

1 Answer

up vote 3 down vote accepted

Mutt is probably looking at the wrong place for the sendmail command.

:set sendmail from within mutt gives you the location where mutt is looking for it. It can also be used for setting the right location e.g. :set sendmail="/usr/sbin/sendmail"

As a side note, mutt is a great program, but nail or mailx are usually the tools of choice for use in a script.

share|improve this answer
    
I've switched to mailx, and all worked out-of-the-box. Thank you! –  Alexander Gladysh Jul 11 '09 at 21:40
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.