mail -s "subject" $user
I'm sending email via command line using linux accounts but it is adding @mail.hostname.com
so the username becomes [email protected]
Is there are way that it just email using local accounts without @mail.hostname.com or change it automatically using @hostname.com
cd /home/dir/11
du -m --max-depth=1 | sed 's/[./]//g' | while read space user
do
if [ $space -gt 100 ]
then
mail -s "using over 100MB " $user <<MAIL
$user:
You are now using $space MB in your home directory.
The total amount of diskspace allowed is 100 MB.
MAIL
fi
done
It is adding the hostname of the machine while sending mail [email protected] where it should be [email protected] , i cant change the local machine hostname since there are some other connections using it. The mail is bouncing back since address is wrong:
This is the Postfix program at host mail.hostname.com.
I'm sorry to have to inform you that your message could not be delivered to one or more recipients. It's attached below.
For further assistance, please send mail to
If you do so, please include this problem report. You can delete your own text from the attached returned message.
The Postfix program
(expanded from ): unknown user: "user1"
Please check this document : http://www.postfix.org/ADDRESS_REWRITING_README.html#generic
Here's excerpt from link.
First you need add generic map table to main.cf.
Then put your mappings ( how outgoing mail will be rewritten ) into "/etc/postfix/generic" . Left hand side is adress to rewrite, the other is the address you need ...
It's also possible to use regexps..
In /etc/postfix/generic_re :
after that you should reload postfix