On 10/7/18 7:45 PM, Manuel Mely wrote: > Hi there, > > I'm designing a mail system with virtual domains and have the following > requirement: > > A virtual domain is able to send/receive mails to/from the Internet or > to/from custom "external domains". > > For that i'm using a MySQL table called > "domain_external_domain_association" which connects my virtual domains > table and another external_domain table. > > Somewhere in my set of smtpd_restrictions_classes there is one class > that uses a check_sender_access where i need to check if the sender > domain (external domain) is in this "domain_external_domain_association" > when the recipient domain is X (my virtual domain) > > So the query looks like this: > > query= SELECT [OK OR REJECT GOES HERE] FROM > domain_external_domain_association AS deda > JOIN domain as d ON deda.domain_id = d.id > JOIN external_domain as ed ON deda.external_domain_id = ed.id > WHERE d.name = 'HERE MY VDOMAIN' AND deda.receive = 1 AND ed.name = '%d' > > Also, the sql query explains the problem by itself :)
Actually, no, it doesn't, entirely. That isn't very clear at all. What do the tables look like? Is that '%d' a formatting placeholder intended to be replaced before the query is evaluated, or are you trying to match ed.name against a string containing a wildcard? (If so, you need to be using ed.name LIKE '%d', not ed.name = '%d'.) Is ed.name an integer or s string? If it's a string, you probably want %s there, not %d. %d is the formatting code for an integer. And what do you mean by [OK OR REJECT GOES HERE]? Are you trying to SELECT a column, a string value, a string literal...? > I think this is not possible to do, at least in the way i want to do it, > because i'm trying to use in the query some information that the > check_sender_access is not aware of. Since you haven't provided enough information to make sense of your query, it's rather difficult to tell that. -- Phil Stracchino Babylon Communications ph...@caerllewys.net p...@co.ordinate.org Landline: +1.603.293.8485 Mobile: +1.603.998.6958