Current time: 05-03-2024, 08:25 AM Hello There, Guest! (LoginRegister)


Post Reply 
Mail traffic accounting
Author Message
ispcomm Offline
Junior Member
*

Posts: 93
Joined: Apr 2008
Reputation: 3
Post: #9
RE: Mail traffic accounting
Kilburn,

try something like this:
Code:
SELECT concat( mail_acc, '@', domain_name ) AS mail_from, domain_name, mail_forward
FROM mail_users
LEFT JOIN domain
USING ( domain_id )
WHERE mail_type = 'normal_forward'
UNION
SELECT concat( mail_acc, '@', subdomain_name, '.', domain_name ) AS mail_from, domain_name, mail_forward
FROM mail_users
LEFT JOIN domain
USING ( domain_id )
LEFT JOIN subdomain
USING ( domain_id )
WHERE mail_type = 'subdom_forward'
UNION
SELECT concat( mail_acc, '@', alias_name ) AS mail_from, domain_name, mail_forward
FROM mail_users
LEFT JOIN domain
USING ( domain_id )
LEFT JOIN domain_aliasses
USING ( domain_id )
WHERE mail_type = 'alias_forward'
This will give you a table if recipients including subdomains, a reference main domain and a mail_forward field (That you need to parse for commas to find out how many recipients are there).

Hope that helps.

ispcomm

EDIT: Typo in the sql query. Fixed.
EDIT2: Full query including domain aliases.
(This post was last modified: 06-19-2008 05:04 AM by ispcomm.)
06-19-2008 04:46 AM
Find all posts by this user Quote this message in a reply
Post Reply 


Messages In This Thread
Mail traffic accounting - ispcomm - 06-13-2008, 11:09 PM
RE: Mail traffic accounting - ispcomm - 06-14-2008, 05:10 AM
RE: Mail traffic accounting - kilburn - 06-18-2008, 10:40 AM
RE: Mail traffic accounting - ispcomm - 06-18-2008, 05:33 PM
RE: Mail traffic accounting - kilburn - 06-18-2008, 09:22 PM
RE: Mail traffic accounting - ispcomm - 06-18-2008, 11:16 PM
RE: Mail traffic accounting - kilburn - 06-19-2008, 12:57 AM
RE: Mail traffic accounting - ispcomm - 06-19-2008, 03:30 AM
RE: Mail traffic accounting - ispcomm - 06-19-2008 04:46 AM
RE: Mail traffic accounting - kilburn - 06-19-2008, 06:25 AM
RE: Mail traffic accounting - kilburn - 06-19-2008, 08:30 AM
RE: Mail traffic accounting - ispcomm - 06-19-2008, 05:18 PM
RE: Mail traffic accounting - Zothos - 06-19-2008, 08:20 PM
RE: Mail traffic accounting - kilburn - 06-20-2008, 02:04 AM
RE: Mail traffic accounting - kilburn - 06-20-2008, 03:51 AM
RE: Mail traffic accounting - ispcomm - 06-20-2008, 07:31 AM
RE: Mail traffic accounting - kilburn - 06-20-2008, 09:34 AM
RE: Mail traffic accounting - ispcomm - 06-20-2008, 05:34 PM
RE: Mail traffic accounting - kilburn - 06-20-2008, 09:58 PM
RE: Mail traffic accounting - ispcomm - 06-20-2008, 11:54 PM

Forum Jump:


User(s) browsing this thread: 1 Guest(s)