I'm sending email via command line using linux accounts but it is adding @mail.hostname.com

Solution 1:

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.

  /etc/postfix/main.cf:
      smtp_generic_maps = hash:/etc/postfix/generic

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 ...

  /etc/postfix/generic:
      [email protected]               [email protected]
      [email protected]               [email protected]
      @localdomain.local                  [email protected]

It's also possible to use regexps..

  /etc/postfix/main.cf:
      smtp_generic_maps = regexp:/etc/postfix/generic_re

In /etc/postfix/generic_re :

  /^(.*)@mail.hostname.com$/   ${1}@hostname.com

after that you should reload postfix

 postfix reload