Mutt through PHP, Could Not Send Message

Keywords´╝Ü php ubuntu lamp mutt

Question: 

I'm running a small LAMP server on ubuntu. At some point, I need a php script to send an email using Mutt. I use a system call from the php script like this

mutt -s $file1 -a threedplot.jpeg -a velocityvstime.jpeg -a elossperstep.jpeg -a input.txt -a output.txt -- $email < /var/www/html/emailmessage.txt

Where all the variables and files are appropriately defined (This line is in runner.sh). When I execute the command from the command line as ubuntu user, there's no problem and the email is sent. But when the php tries executing it with a system call,

$last_line = system("./runner.sh Queued/", $retval);

it just says "Could not send the message". I suspect that this is because the php runs on the www-data user, which may not have the proper permissions. Is there a way to add the www-data user so it has full access to Mutt? Thanks

Answers: