# postfix ignores my aliases

## schiotz

I apparently have a problem with postfix on two different machines.  It ignores my aliases file (yes, I have run newaliases  :Smile: ).

Apparently, the problem is that postfix first appends my domain to the address, before it looks in the aliases file.  And then root@mydomain.dk no longer matches the line in aliases saying

root:   myuser@mydomain.dk

Is there any way to make postfix look in aliases before appending the domain name?

----------

## acasto

Can you post your main.cf file?

- Adam

----------

## schiotz

 *acasto wrote:*   

> Can you post your main.cf file?
> 
> 

 

Here it comes, stripped with

```
grep -v '^#' /etc/postfix/main.cf | grep '[^ ]'
```

 to get rid of all the comments etc.

```

queue_directory = /var/spool/postfix

command_directory = /usr/sbin

daemon_directory = /usr/lib/postfix

mail_owner = postfix

myorigin = $mydomain

inet_interfaces = localhost

mydestination = localhost, $myhostname, localhost.$mydomain

unknown_local_recipient_reject_code = 550

mynetworks_style = host

relayhost = mail.$mydomain

debug_peer_level = 2

debug_peer_list = 127.0.0.1

debugger_command =

    PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin

    xxgdb $daemon_directory/$process_name $process_id & sleep 5

sendmail_path = /usr/sbin/sendmail

newaliases_path = /usr/bin/newaliases

mailq_path = /usr/bin/mailq

setgid_group = postdrop

html_directory = no

manpage_directory = /usr/share/man

sample_directory = /etc/postfix

readme_directory = /usr/share/doc/postfix-2.1.5-r2/readme

default_destination_concurrency_limit = 2

mail_spool_directory = /var/spool/mail

alias_database = hash:/etc/mail/aliases

local_destination_concurrency_limit = 2

alias_maps = hash:/etc/mail/aliases

```

It is only minimally modified.  BTW, I use the latest stable postfix:

```
root # etcat -v postfix

[ Results for search key           : postfix ]

[ Candidate applications found : 4 ]

 Only printing found installed programs.

*  mail-mta/postfix :

        [   ] 2.1.5-r1 (0)

        [  I] 2.1.5-r2 (0)

        [M~ ] 2.2_beta20050218 (0)

        [M~ ] 2.2.0_rc1 (0)

```

/Jakob

----------

## langthang

try commented out myorigin = $mydomain?

----------

## Ateo

myorigin = $mydomain? Great. But what does mydomain equal? You need to define mydomain...

```
mydomain = domain.tld
```

----------

## schiotz

 *langthang wrote:*   

> try commented out myorigin = $mydomain?

 

 *Ateo wrote:*   

> myorigin = $mydomain? Great. But what does mydomain equal? You need to define mydomain...
> 
> ```
> mydomain = domain.tld
> ```
> ...

 

Thank you very much for your replies.  Removing the myorigin line solved the problem - but it created a new one.  Now the from address on mails contain the hostname of the machine, but that hostname depends on the DHCP server (this is a laptop), and bounces never make it back to me.

The $mydomain variable defaults to the current value of the domain name, so you do not have to set it.  I had changed the myorigin line just before posting, it used to be my domain name (written explicitly), but that made no difference.

Thanks for your help!

----------

## langthang

try this: http://www.postfix.org/postconf.5.html#masquerade_domains

----------

## schiotz

 *langthang wrote:*   

> try this: http://www.postfix.org/postconf.5.html#masquerade_domains

 

Thank you very much!  That solved my problem.  :Very Happy: 

/Jakob

----------

