Getting the client email starting from the domain_id

Discussion in 'Developers' Forum' started by vaio1, Nov 2, 2012.

  1. vaio1

    vaio1 ISPConfig Developer

    Hi Guys,

    how have I to get the client's email stating from the domain_id value?

    thanks
     
  2. Croydon

    Croydon HowtoForge Supporter

    Could you please be a bit more precise in what you want to do?
     
  3. vaio1

    vaio1 ISPConfig Developer

    Hi again, I need to create a query to get the client email starting from one of his webdomains (domain_id)

    So I have to Select email from clients where ??? Join ???

    is there a E.R (Entity Relationship Diagram) of ISPConfig?

    thanks
     
  4. till

    till Super Moderator

    Most records in ispconfig have a column sys_group_id which define the group a record belongs to and each group is woned by a client. So you can get the client that owns a record by using the sys_group_id of the record that you have, then look up the client_id from sys_group table.
     
  5. Croydon

    Croydon HowtoForge Supporter

    In general there is no direct link (in the database) between ONE web domain and email addresses!

    If you want to access a list of emails that MIGHT(!) be connected to a given WEB domain you could try doing a join like this.

    SELECT email FROM mail_user INNER JOIN web_domain ON (SUBSTR(email, INSTR(email, '@')+1) = domain) WHERE web_domain.domain_id = 12345

    It's not guaranteed to work because of the things I stated above.
     

Share This Page