QEHNick Posted June 2, 2023 Share Posted June 2, 2023 Hello, I'm trying to put together some "measures" to record how many emails come through the mailbox from INTERNAL and EXTERNAL sources. I've tried several different ways, most recently..... ...using a "Query where clause" in this vein. h_msg_rfc822_hdr LIKE '%From%OURDOMAINNAME%' ..or.. h_msg_rfc822_hdr NOT LIKE '%From%OURDOMAINNAME%' The results are incorrect, too low to match what is actually coming through. Does anyone have a way of doing this? Link to comment Share on other sites More sharing options...
Steve Giller Posted June 2, 2023 Share Posted June 2, 2023 I can't see how that would work in the first place. "from" appears a whole bunch of times in that record, and before the "To" address, so it would pick up anything sent to your domain as well as from it. Link to comment Share on other sites More sharing options...
QEHNick Posted June 2, 2023 Author Share Posted June 2, 2023 @Steve Giller Yeah, I can't find a row which would have what I need to determine it. Ah! I suppose if h_msg_from had sender address which had "somethingsomething@DOMAIN.com", that would be my external since internals do not show the email address, just the senders name. So something like... h_msg_from NOT LIKE '%@%' for internal emails? Link to comment Share on other sites More sharing options...
Steve Giller Posted June 2, 2023 Share Posted June 2, 2023 You'd have to validate that for your configuration, I don't have the exact criteria to hand for what records a name vs an email address, but assuming that these match internal Customers this sounds logical. Link to comment Share on other sites More sharing options...
QEHNick Posted June 2, 2023 Author Share Posted June 2, 2023 @Steve Giller yeah, I narrowed it down to the actual domain ('%@domainname.co.uk') however it's producing ridiculously high figures now. We have never had 100+ emails in a week. So I tried replacing "LIKE" for "=" and "NOT LIKE" for "<>"; this then tells me we had over 4000 emails from external sources and zero from internal in a month. That's nowhere near reality. Link to comment Share on other sites More sharing options...
Steve Giller Posted June 2, 2023 Share Posted June 2, 2023 Are you putting a condition in to specify received emails? Link to comment Share on other sites More sharing options...
QEHNick Posted June 12, 2023 Author Share Posted June 12, 2023 Ah, good point @Steve Giller. I'm just looking at the mailbox. What would I need to use there then? One of the h_msg_status codes? Link to comment Share on other sites More sharing options...
QEHNick Posted June 12, 2023 Author Share Posted June 12, 2023 Yeah I think it's h_msg_status code "1" for received. Link to comment Share on other sites More sharing options...
QEHNick Posted June 12, 2023 Author Share Posted June 12, 2023 Ok, after much fiddling about I have used the following. For Internal emails - h_msg_rfc822_hdr NOT LIKE '%Return-path% %@OUR_DOMAIN_NAME%' AND h_msg_status = 1 For Internal emails - h_msg_rfc822_hdr LIKE '%Return-path% %@OUR_DOMAIN_NAME%' AND h_msg_status = 1 Since there is no column entry for sender domain I have to look through the HDR content to find the necessary info to filter on. So far, the output compares to the emails in the Inbox (and other) folders. Link to comment Share on other sites More sharing options...
Met Posted June 12, 2023 Share Posted June 12, 2023 2 hours ago, QEHNick said: Yeah I think it's h_msg_status code "1" for received. I think h_msg_status determines whether the email has been read or not. 1 = read, 2 = unread. Link to comment Share on other sites More sharing options...
QEHNick Posted June 12, 2023 Author Share Posted June 12, 2023 Ah that would make some sense. Cheers @Met, I'll remove that statement as it's not relevant. Link to comment Share on other sites More sharing options...
QEHNick Posted June 12, 2023 Author Share Posted June 12, 2023 Weirdly, removing it made the figures go way high! More than the number of emails we had in. I'll keep it in... Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now