exim4:reject_emails_with_many_to_cc_recipients
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
exim4:reject_emails_with_many_to_cc_recipients [2016/11/02 09:28] – created peter | exim4:reject_emails_with_many_to_cc_recipients [2020/07/15 09:30] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Exim4 - Reject emails with many To/Cc recipients ====== | ====== Exim4 - Reject emails with many To/Cc recipients ====== | ||
- | First, it is important that you understand that a customer can send an email with 1 address in the To header but actually send it to 1000 people if they figure out how to abuse it just right. Counting the number of email addresses in the To: or Cc: header does not guarantee that you'll block emails that a customer is sending. You'll only block their emails if they abuse your system in a naive way. However, you stated that they are just putting everything in the To field (i.e. the naive way), so the rest of this answer assumes that's the way the data is being submitted to your Exim server. | + | How to prevent emails being sent to huge mailing lists or stopping messages when users have used reply-all against |
- | Now, to answer your question directly as you asked it: In the DATA ACL (only in the DATA ACL!), you can check the number of email addresses in the To or Cc header by a two step process. To test these headers, you access it with $h_To: and $h_Cc: The trailing colon is required. Let's assume that the To: header is: | + | **WARNING**: |
+ | |||
+ | In the **DATA ACL** (only in the DATA ACL!), you can check the number of email addresses in the To or Cc header by a two step process. | ||
< | < | ||
- | "Org user" <todd@example.org>,< | + | "Test user" <john@example.org>,< |
</ | </ | ||
- | With this example, I'll show you what each step of the two step process does: | ||
- | # Step 1: To header converted to a (colon-separated) list | + | ===== Step 1: To header converted to a (colon-separated) list ===== |
<code bash> | <code bash> | ||
- | $ exim -be ' | + | $ exim -be ' |
- | todd@example.org: | + | john@example.org: |
</ | </ | ||
- | # step 2: Now count the number of list items | + | |
+ | ===== step 2: Now count the number of list items ===== | ||
< | < | ||
- | $ exim -be ' | + | $ exim -be ' |
</ | </ | ||
- | With current versions of exim (4.82), what this will ultimately look like in your DATA ACL will be something like this: | + | With current versions of Exim (4.82), what this will ultimately look like in your **DATA ACL** will be something like this: |
< | < | ||
Line 32: | Line 35: | ||
</ | </ | ||
- | If you are using an older version, such as what's in Debian stable, | + | If you are using an older version you can use an older version that iterates over the list and increments a counter: |
< | < | ||
Line 39: | Line 42: | ||
</ | </ | ||
- | Note that in both cases above, the {yes}{no} portion is superfluous. | + | Note that in both cases above, the **{yes}{no}** portion is superfluous. |
exim4/reject_emails_with_many_to_cc_recipients.1478078933.txt.gz · Last modified: 2020/07/15 09:30 (external edit)