How are sys_userid, sys_groupid determined for forwarding e-mail mappings?

Discussion in 'Developers' Forum' started by fatbear, Jan 6, 2013.

  1. fatbear

    fatbear Member HowtoForge Supporter

    I'm working on a script to allow me to bulk import mail forwards. When I add forwards manually, I can see the MySQL table mail_forwarding specifies the sys_userid and sys_groupid fields. I want to determine how to pick values for these fields based on the source e-mail domain.

    I first thought it would be the web_domain table, but in this table, all of the sys_userid values are 1, even though I have multiple domains.

    I next thought it might be dns_soa, but it seems that the sys_userid and sys_groupid values here are 1:1 with a specific client, not with a domain.

    Can anyone tell me sys_userid and sys_groupid are computed when adding a forwarding e-mail address?
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    The values in a foward are the same then the ones of the mail_domain.

    As a general note: Use the remote api to add the forwards, the sys_userid and sys_groupid are set by the functions automatically. Adding them to the tables manually will lead to invalid transactions and no changes will get written to disk, so dont add anything to the ispconfig database directly, use the api.
  3. fatbear

    fatbear Member HowtoForge Supporter

    I forgot that there was code in the ISPConfig- file. I found two relevant files.


    In the latter, I see that $params needs server_id. What is the appropriate way to get this? Via a MySQL query? Or, because this isn't likely to change, just hard code it?
    Last edited: Jan 6, 2013
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    The server_id of a forward is the same then the one of the mail_domain as the forward has to be created on the same server.

Share This Page