Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How to edit/override virtual_aliases_nostar

Discussion in 'E-mail Discussions' started by rclemings, Nov 22, 2016.

  1. rclemings

    rclemings Active Member

    Nov 5, 2007
    Likes Received:
    Trophy Points:
    I'm having some trouble with Exim that seems to be caused by the "unseen" directive in virtual_aliases_nostar director in the WHM Exim configuration, advanced editor.


    I have a website on and a mail server on, and I want to use server1 as a smarthost for server2. So I added this to te "PREROUTERS" section in Exim, advanced editor, on server2 (adapted from Howto: redirect a copy of your emails to another server while saving it locally):

    driver = manualroute
    domains = !+local_domains
    transport = remote_smtp
    headers_add = X-Custom-Forwarded: true
    condition = ${if match {$h_X-Custom-Forwarded:}{true}{false}{true}}
    route_data = ""

    That worked for all domains that existed on both servers.

    However, I have some domains that have their websites on server2, and only their DNS on server1. To get the smarthost to work for those domains, I had to add the domain name to /etc/localdomains and create a corresponding /etc/valiases file.

    After I did that, the mail sent from server2 was successfully delivered by server1, but the sender also got a failure notice.

    I entered the address into the Mail troubleshooter on server1 and got something like this:
    virtual_aliases_nostar via /etc/userdomains
    virtual_aliases via virtual_aliases router forced address failure

    In other words, the message was going first to virtual_aliases_nostar, then to virtual_aliases (apparently because of the "unseen" directive in virtual_aliases_nostar). It was delivered by virtual_aliases_nostar but then failed by virtual_aliases.


    It doesn't seem possible to edit virtual_aliases_nostar, so instead I added this to the "PREVALIASNOSTAR" section just above virtual_aliases_nostar:

    driver = redirect
    require_files = "+/etc/valiases/$domain"
    address_data = ${lookup{$local_part@$domain}lsearch{/etc/valiases/$domain}}
    data = $address_data
    file_transport = address_file
    group = "${lookup{$domain}lsearch* {/etc/userdomains}{$value}}"
    user = "${lookup{$domain}lsearch* {/etc/userdomains}{$value}}"
    pipe_transport = ${if forall{/bin/cagefs_enter:/usr/sbin/cagefsctl}{exists{$item}}{cagefs_virtual_address_pipe}{${if match{${extract{6}{:}{${lookup passwd{${lookup{$domain}lsearch*{/etc/userdomains}{$value}}}{$value}}}}}{\N(jail|no)shell\N}{jailed_virtual_address_pipe}{virtual_address_pipe}}}}

    Basically, that's an exact copy of virtual_aliases_nostar, minus the "unseen" directive. It seems to fix my specific problem with no immediately visible side effects.


    Is this going to cause other problems? And is there a better solution?

    FWIW, all of the addresses for these domains are forwarders in the /etc/valiases files; there are no actual mailboxes. Autoresponders still seem to work OK.
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Apr 11, 2011
    Likes Received:
    Trophy Points:
    cPanel Access Level:
    Root Administrator

    Those steps should work well based on the information you provided, and the changes should not be overwritten during updates.

    Let us know if you encounter any problems with this configuration in the future.

    Thank you.

Share This Page