number of outgoing emails is incorrect

gate2vn

Verified User
Joined
Nov 9, 2004
Messages
521
Location
Oslo
A customer gets a warning that their account has reached 20K email / day sending out. However, when checking in /etc/virtual/usage/username.bytes, the total outgoing emails in the last 25 hours are around 7934 emails, not 20000.

I am using this command for checking the going emails
grep "method=outgoing" /etc/virtual/usage/username.bytes | grep -oP 'email=\K[^&]+' | sort | uniq -c | sort -nr

How to debug to find out the reason?
Thanks.
 
Usage at the user level is giving out warning. That's why I double check in /etc/virtual/usage. But then the numbers are different. That's why I want to find out the reason.
 
A customer gets a warning that their account has reached 20K email / day sending out. However, when checking in /etc/virtual/usage/username.bytes, the total outgoing emails in the last 25 hours are around 7934 emails, not 20000.

I am using this command for checking the going emails


How to debug to find out the reason?
Thanks.

Maybe....starting from update 1.702, sent email limits also count local-to-local messages.
Previously, emails sent between local accounts on the same server were not counted toward the daily sending limit
I'm also looking for a way to get rid of this.
 
@gate2vn, the /etc/virtual/usage/username.bytes file contains one for each unique email ID. However single email can have multiple recipients.

Old Exim configuration used to account each recipient individually. New Exim configuration counts only unique message IDs for bandwidth (the /etc/virtual/usage/username.bytes file) but total number of recipients for the send limit (the /etc/virtual/usage/username file).

@DVD we can add customisable condition to optionally disable the local sends accounting.

This would allow you to continue ignoring local-to-local emails. However, in the long term I think it would be better to adjust the limits accordingly and not rely on local sends to be exempt from accounting.
 
We also prefer the old method of accounting for mails, which does not include local delivery.
Custom behavior would be a great option.
 
....However, in the long term I think it would be better to adjust the limits accordingly and not rely on local sends to be exempt from accounting.

Nothing to say ! Flawless !
But in ipotetic scenarios, this behavior causes major issues.

For instance, consider a case where info@ (or accounting@, or ...) receives 100 legitimate emails from internal/external

Since this address acts as an alias/forwarder (es. a certain department has 5 employees who all need to have the same communication personally) that automatically forwards messages to 5 internal accounts (user1@, user2@, etc.)... so a single internal email instantly counts as 5 sends, quickly draining the daily limit...
 
I am not sure I fully understand the scenario you are describing. Things to keep in mind about the current Exim configuration:
The sent email counting happens before Exim routes the email (expands the forwarders).

It is possible to use up the sent email limit if email is sent from [email protected] to [email protected], [email protected], [email protected], ... In other words if instead of writing an email to the forwarder address the sender would instead add multiple recipients in the To: field.

The send limit could be drained in the following scenario:

User [email protected] writes an email:


This first email arriving from external host does not count into any send limits. However when [email protected] hits Reply To All button on his email client, he sends the following email:


Such email would increase the john mailbox send limit by 4, because he sent an email to 4 recipients.



The local send exemption flag I was planning to add would not help in mixed local/external recipients scenario. The flag for disabling local sends would look like this:

Code:
APPLY_SEND_LIMIT = ${if forany{$recipients_list} { !match_domain{${domain:$item}}{+local_domains} }}

This Exim config blob could be translated as - count sent emails as usual if at least one of the recipients domain is not managed by this server.

This would mean the example above would still bump the mailbox [email protected] by 4 because one of the recipients is external.



Another thing to keep in mind. The main reason for counting local-to-local sends is to make sure if a company A and company B happens to be using the same server, the emails between them would be properly counted.

It seems too me that you are more interested in not counting the emails from same domain to same domain, not emails from same server to same server (different domains). The old Exim behaviour was to not count emails to the same server.
 
If [email protected] has e.g. an automated tool that sends a lot to e.g. [email protected], you don't want to be forced to increase his outgoing send limit, unless you can still limit the real outgoing mail to anything but *@domain.com.
This is imho safer regarding spam-runs and hacked mail accounts (1000 mail spike anomalies to internal accounts should be visible, but is less worse than 1000 spammails going external). But counting is still good, even for internal mails. After all it's a service on your server and you want to see numbers.
 
Back
Top