Sub topic 2
Legal and mailbox-provider expectations
This chapter assumes you know what a spam complaint and sender reputation are, and that you can read a short SQL schema. It covers the rules your subscription flow has to satisfy: the law that applies to the people on your list, and the technical requirements that Gmail, Yahoo and Outlook.com enforce on mail that reaches their users. It is a developer's orientation, not legal advice. Ask a lawyer about your own list.
Two sets of rules
Two different groups can stop you from sending.
- Regulators enforce statutes. They act on complaints and audits, and the penalties are fines.
- Mailbox providers enforce their own sender requirements. They act automatically and continuously. Their penalty is silent: your mail goes to spam or is rejected, and nobody tells you.
The two sets overlap but are not the same. A flow can be legal in your country and still be throttled by Gmail. A flow built to the strictest rules from both groups rarely has problems with either.
The main legal regimes
Four regimes come up most often. They differ on one question: must you have consent before the first message, or only honour opt-outs afterwards?
| Regime | Applies to | Consent model | Key obligations |
|---|---|---|---|
| GDPR and ePrivacy Directive (EU/EEA, plus UK equivalents) | People located in the EU/EEA | Opt-in. Prior consent for marketing email, with a narrow exception for existing customers | Consent that is freely given, specific, informed and unambiguous. You must be able to demonstrate it. Withdrawal must be as easy as giving consent |
| CAN-SPAM (US) | Commercial email in the US | Opt-out. You may send without prior consent | Accurate header and subject, identify the message as an ad, include a postal address, provide a working opt-out, honour it within 10 business days |
| CASL (Canada) | Commercial electronic messages sent to or from Canada | Opt-in. Express or implied consent | Identify the sender, include an unsubscribe mechanism, honour requests within 10 business days. Implied consent expires |
| Mailbox-provider rules | Mail delivered to Gmail, Yahoo, Outlook.com | Not a consent law, but enforced through complaint rates and authentication | Authentication, one-click unsubscribe, low complaint rate |
GDPR and ePrivacy
Two laws work together here. The ePrivacy Directive (Article 13, as implemented in each member state) decides that you need consent to send unsolicited marketing email. The GDPR defines what counts as valid consent and what you must do with the data.
Under the GDPR, consent has to be:
- Freely given. You cannot make it a condition of something unrelated, and the choice cannot be bundled with other purposes.
- Specific. Consent to a weekly newsletter is not consent to share the address with partners.
- Informed. The person must know who you are and what they will receive.
- Unambiguous. A clear affirmative action is required. Pre-ticked boxes and silence do not count.
Two further GDPR requirements shape the code you write later in this tutorial:
- You must be able to demonstrate consent. The burden of proof is on you, not on the subscriber. This is why the later chapter on audit trails records the time, source, wording, IP address and user agent of each consent event.
- Withdrawing consent must be as easy as giving it. If signing up takes one form field, unsubscribing cannot require a login and a support ticket.
The ePrivacy Directive has a narrow exception, often called the soft opt-in. If you collected the address during a sale to the person, you may market your own similar products without fresh consent, provided you offered an opt-out at collection and include one in every message. Do not stretch it to cover bought lists or unrelated products.
CAN-SPAM
The US law does not require prior consent. It regulates how you send. Your message needs truthful header information, a subject line that is not deceptive, a clear statement that it is an advertisement (where applicable), your physical postal address, and a working opt-out. You may not charge a fee or ask for more than the email address to process the opt-out, and you must honour it within 10 business days.
CAN-SPAM is the most permissive of the four regimes. Treat it as a floor, not a design target. If your list includes anyone in the EU or Canada, the stricter rules apply to those people.
CASL
Canada's law requires consent before you send a commercial message. Express consent is an explicit opt-in. Implied consent exists in limited cases, such as an existing business relationship, and it expires. For example, a purchase gives you a limited window, and an enquiry gives you a shorter one. Your data model therefore needs to know the source and date of each consent, not just a yes or no. The consent record described in this tutorial supports that.
Where double opt-in fits
None of these laws names double opt-in as a requirement. The legal question is whether you can show that the owner of the address agreed. A single opt-in form only proves that someone typed an address into a box. A confirmed address proves that the owner of the mailbox took an action. In some places, notably Germany, case law has made double opt-in the practical standard for proving consent. Elsewhere it is a strong form of evidence rather than a mandate.
Mailbox-provider expectations
Since early 2024, Gmail and Yahoo have enforced sender requirements on bulk senders. Gmail defines bulk as more than 5,000 messages per day to Gmail addresses. Microsoft announced comparable requirements for Outlook.com and related consumer domains for high-volume senders from May 2025. The specifics change, so check each provider's current sender guidelines. The common elements are:
- Authentication. SPF and DKIM must pass, and the sending domain needs a DMARC policy. The visible From domain must align with at least one of the authenticated domains.
- One-click unsubscribe. Marketing and subscribed messages must carry List-Unsubscribe and List-Unsubscribe-Post headers following RFC 8058, and the sender must process the request promptly. Gmail and Yahoo set the limit at two days.
- A visible unsubscribe link in the message body as well.
- A low spam complaint rate. Gmail's guidance is to stay below 0.10% in Postmaster Tools and never reach 0.30%. Above those levels, you lose eligibility for mitigation and your mail is increasingly filtered.
- Valid DNS and TLS, and no impersonation of the providers' own domains.
Here is the header pair from the code example for the later chapter on headers:
List-Unsubscribe: <https://example.com/unsubscribe/TOKEN>, <mailto:[email protected]?subject=unsubscribe>
List-Unsubscribe-Post: List-Unsubscribe=One-ClickThe headers must be covered by the message's DKIM signature. A mail client that sees them can show its own unsubscribe button, which is often easier to reach than your footer link. Subscribers who cannot find an unsubscribe control use the spam button instead, which is the signal the providers measure.
How the rules map to your design
Each external rule translates into a requirement for the system you build in the next chapters.
| Expectation | Where it shows up in the build |
|---|---|
| Prove consent (GDPR, CASL) | A `consent_events` table with time, source, wording, IP address and user agent |
| Consent is specific | Separate topic preferences instead of one global flag |
| Withdrawal is as easy as signing up | One-click unsubscribe, no login required |
| Honour opt-outs fast (CAN-SPAM, CASL, providers) | A suppression list checked before every send |
| Low complaint rate (providers) | Double opt-in, easy unsubscribe, and a preference centre as an alternative |
| Authenticated mail (providers) | SPF, DKIM and DMARC in place before the first confirmation email goes out |
Common mistakes
- Reading CAN-SPAM as the only rule. It permits mailing without consent, but only for recipients covered by it. EU and Canadian subscribers need opt-in.
- Treating a checked box as consent. A pre-ticked checkbox does not meet the GDPR's standard.
- Keeping no evidence. A
status = 'confirmed'column does not show when, where or under what wording the person agreed. You need the event history. - Counting on the legal deadline. CAN-SPAM allows 10 business days, but Gmail and Yahoo expect action within two days. Process unsubscribes immediately.
- Hiding the unsubscribe control. It saves a few departures and costs you complaints, which damage deliverability for the whole list.
- Assuming a provider's numbers are fixed. Thresholds and dates are revised. Keep your own monitoring in place rather than relying on a number you read once.
Exercise
A US-based shop sells to customers worldwide. A visitor in France enters their address in a newsletter form that has a pre-ticked "Send me offers" box and no confirmation step. Name two problems with this setup, and one change that addresses both.
Show answer
First, a pre-ticked box is not an unambiguous affirmative action, so it does not meet the GDPR standard for consent, which the ePrivacy rules require before marketing email to someone in France. Second, with no confirmation step and no stored evidence, the shop cannot demonstrate that the owner of the address agreed, and a mistyped or malicious address can reach a third party. Replacing the pre-ticked box with an unticked one and adding a double opt-in step that records the consent event (time, source, wording, IP address, user agent) addresses both.
Exercise
Your marketing emails already contain a visible unsubscribe link in the footer, and you honour requests within 10 business days. Which provider requirements does this still fail to meet, and why does the legal deadline not settle the question?
Show answer
Gmail and Yahoo expect List-Unsubscribe and List-Unsubscribe-Post (one-click, RFC 8058) headers on bulk marketing mail, with requests processed within two days. A footer link alone and a 10-business-day turnaround meet the CAN-SPAM deadline but not the mailbox-provider rules. The provider rules are enforced automatically through filtering and complaint rates, so meeting the statutory minimum does not protect your deliverability.