I'm trying to send an email from within a script which is running as root,
but I want to have the email come from a user.

I've made these two attempts, but neither work.

.....

su - user
mail -s "subject line" < mail.file  another.user@domain
exit
.....

su user --command=mail -s "subject line" < mail.file another.user@domain

.....


In both cases the mail is actually sent but comes from root. In the first
version, the exit command doesn't appear to do anything and after exiting
the script I'm still in the user's shell.


If anyone has a suggestion I would really appreciate it.

David.

-- 
SLUG - Sydney Linux User's Group - http://slug.org.au/
More Info: http://lists.slug.org.au/listinfo/slug

Reply via email to