Mail for user of one domain being delivered to admin of another

Discussion in 'Installation/Configuration' started by rachel, Sep 20, 2007.

  1. rachel

    rachel New Member

    I broke something, because it *was* working.

    On my ISPConfig install I have two sites. One is "", the other is "" <not really, real name obscured>. Each "site" has co-domains set up, "" and "" respectively, plus some others.

    Mail addressed to [email protected] is turning up in my inbox ([email protected]). That mailbox is also the defined Admin and Catch-All address for the domain. 'jim' is the defined admin and catch-all address for There is no 'jim' user in the domain.

    (btw, I've defined no username prefix, so "[email protected]" maps to actual user "jim" and so on.)

    I've no idea why the mail is coming to me. Here is what I find.

    When it happens, mail.log shows:

    Sep 20 21:48:35 aziza postfix/local[16308]: 79EF43444E47: to=<[email protected]>, orig_to=<[email protected]>, relay=local, delay=2.9, delays=0.1/0.01/0/2.8, dsn=2.0.0, status=sent (delivered to command: /usr/bin/procmail -f-)
    ... which doesn't give me much clue as to why it did it. It's happening both to incoming mail from outside, and from mail sent through the same server (by me, testing).

    /etc/postfix/localhostnames does contain:
    /etc/postfix/virtusertable does contain:
    [email protected] jim jim
    [email protected] jim jim
    What's going on? More importantly, how can I fix it?

    I'm still hunting myself, and in a slight hurry! If I'm true to form, I'll probably post my own answer which I can't possibly find until I've posted the question. :-}

    P.S. It's an Ubuntu Feisty server with Perfect Setup (following the howto here) and ISPConfig 2.2.16, all recently installed. I did recently change the IMAP/POP3 server from courier-imap to dovecot (to solve problems with some users using Apple but I can't see how that would break *this*.
    Last edited: Sep 20, 2007
  2. till

    till Super Moderator Staff Member ISPConfig Developer

  3. rachel

    rachel New Member

    Hmm. It looks like it, but I'm having a surprising amount of trouble fixing it nonetheless. Also, it's not quite clear how it ever worked (which it certainly did). I'd changed myhostname from to - but that would still have made mydomain automatically; I'd never set mydomain specifically.

    I've set mydomain specifically to a domain I don't actually receive mail on, and I've removed that domain from the co-domains listed for my site; I even changed the MX record for that domain to point to another. But it's still writing that domain out to local-host-names. Even when I delete those lines specifically from that file, they reappear when it's rewritten (as you'd expect), but I don't know why it's doing it; what in the ISPConfig configuration is telling it to do that.
    Last edited: Sep 21, 2007
  4. rachel

    rachel New Member

    I had to empty the recycle bin.

    That looks like an ISPConfig bug. It writes out config for stuff that's in the recycle bin :)
  5. rachel

    rachel New Member

    Still broken, can't fix

    I thought that would fix it, but it doesn't. My attempts to fix it based on that just kept ended up getting the "mail loops back to myself" error instead.

    At the moment it's just reverting to sending the mails to me as site admin, with no error.

    This was an interesting but ultimately unsatisfying thread too, as I find myself agreeing with NETabuse. postfix configuration "virtual_maps" is no more, as of current versions of Postfix.

    [email protected]:/etc/postfix# postconf virtual_maps
    postconf: warning: virtual_maps: unknown parameter
    It's in the file

    [email protected]:/etc/postfix# grep virtual_maps
    virtual_maps = hash:/etc/postfix/virtusertable
    But I do wonder if Postfix is taking any notice of it. I note however:

    [email protected]:/etc/postfix# postconf virtual_alias_domains virtual_alias_maps virtual_maps
    postconf: warning: virtual_maps: unknown parameter
    virtual_alias_domains = $virtual_alias_maps
    virtual_alias_maps = $virtual_maps
    Which appear to be the default. So maybe it does still read it, via that. Certainly changing virtual_alias_maps to point directly at virtusertable, and unsetting virtual_alias_domains didn't help.

    And it does seem wrong to be listing all the virtual domains in mydestination rather than using virtual_alias_domains.

    But, that's how I've got it set up at the moment.

    [email protected]:/etc/postfix# postconf myhostname mydomain myorigin
    myhostname =
    mydomain =
    myorigin = /etc/mailname
    [email protected]:/etc/postfix# cat /etc/mailname
    /etc/postfix/local-host-names does not list anywhere.

    As can be seen above, I set myhostname back to the same name as listed in Management->Server->Settings, as per the last post in that referenced thread, it made no difference.
  6. rachel

    rachel New Member

    Just to add, the result in mail.log while the above is as it is, is:

    Sep 21 14:50:03 aziza postfix/local[11422]: 0D7203444E4B: to=<[email protected]>, orig_to=<[email protected]>, relay=local, delay=4.5, delays=0.14/0.01/0/4.4, dsn=2.0.0, status=sent (delivered to command: /usr/bin/procmail -f-)
  7. till

    till Super Moderator Staff Member ISPConfig Developer

    If you get a "mail loops back to myself" error, add the domain mentioned in the error message at the end of /etc/postfix/local-host-names and restart postfix.
  8. rachel

    rachel New Member

    I'm not. There's no error message.

    (See above.)
  9. till

    till Super Moderator Staff Member ISPConfig Developer

    Ok, but you posted above:

    And there is always a domain name mentioned in this error message.
  10. rachel

    rachel New Member

    Yes, I appear to have been talking out of my arse, as a side-effect of the stress. :) You know what it's like when you know you're haemorrhaging mail...

    With settings as detailed above, which look right to me, I am not getting loops-back error messages, the mails are just being pushed to me instead.
  11. rachel

    rachel New Member

    I get the loops-back when I change myorigin (via /etc/mailname) back to instead of just I think that's where the confusion came from, as i initially tried that too.

    That's because it then redirects the mail to [email protected] which is indeed not in local-host-names. But it shouldn't be doing that redirect anyway!
    Last edited: Sep 21, 2007
  12. till

    till Super Moderator Staff Member ISPConfig Developer

    Ok, if you had in /etc/mailname, mail delivery can not work. Please see the FAQ that I posted.

    So, cahnge /etc/mailname to "" and then add "" at the end of /etc/postfix/local-host-names and restart postfix.
  13. rachel

    rachel New Member


    I did as you said. Now I get:

    Sep 21 15:17:56 aziza postfix/local[12357]: 3E1063444E4B: to=<[email protected]>, orig_to=<[email protected]>, relay=local, delay=0.31, delays=0.12/0.01/0/0.18, dsn=2.0.0, status=sent (delivered to command: /usr/bin/procmail -f-)
    It really doesn't seem right anyway. I said it was myorigin that was set to, not mydomain.
  14. rachel

    rachel New Member

    oh wait, maybe it did work. 'jim' seems to think he received it anyway...

    I think I might be starting to understand why...
  15. till

    till Super Moderator Staff Member ISPConfig Developer

    The output is perfectly ok if the system user is named jim.

    By the way, you should not disable the username prefix if you dont want to get in troble with falsely redirectde emails.
  16. rachel

    rachel New Member

    Yeah, it seems to be fixed; that last time I think I was just misconstruing.

    I'll concede if it had said [email protected] I would have sussed what was going on :) However, I'm not running very *many* users/sites, and I wanted the convenience of 'normal' usernames on the system.

    It may be that I shouldn't be using ISPConfig but webmin or something. Or just do it by hand, but I wanted to be lazy and paid the price. :)

    I'm still not really understanding why it is the way it is.

    myorigin seems to be *supposed* to be the domain that's appended to locally-generated mails.

    "The domain name that locally-posted mail appears to come from, and that locally posted mail is delivered to. The default, $myhostname, is adequate for small sites. If you run a domain with multiple machines, you should (1) change this to $mydomain and (2) set up a domain-wide alias database that aliases each user to [email protected]host."

    Ah, "and that locally posted mail is delivered to". Even so, on its own still resolves to the same machine. hm, but is an entry in virtusertable that points to me.

    Code: rachel
    OK, I think I get it now. :)
  17. rachel

    rachel New Member

    To summarise then, for the next person with this problem; not only must $mydomain not appear in /etc/postfix/local-host-names, but $myorigin should:

    • - be a hostname, not a domain name
    • - be listed in /etc/postfix/local-host-names (to avoid loops-back)
    • - not be listed in /etc/postfix/virtusertable

    To that end it seems to be vitally important not to add the value in $myorigin as a co-domain, but only to add it manually at the bottom of local-host-names.
    Last edited: Sep 21, 2007

Share This Page