ErrorsBuilt-in services · rule
email.sent_in_bulk
A transactional email is sent to each item of a loop or a batch with the same words for everyone, as bulk mail is, without bulk mail's unsubscribe.
Area 16, Built-in services; declinable; the next step is usually the agent's.
Why Jadpo refuses it
An EmailMessage is transactional: it tells one person about their own
account, order or request, and goes to them whether or not they want
newsletters. The same news sent to many people is bulk mail, which carries
a one-click unsubscribe and isn't sent to anyone who used it. Sending it as
an EmailMessage would skip both, and mail providers send a sender's mail
to spam when its readers can't stop what they didn't ask for.
Jadpo can't read what an email means, so it looks at how it is sent: an
email emitted for each item of a for loop, or by the action a batch's
each: calls, with nothing in it but to: and locale: differing from
one item to the next. An email that names each person's own book or total
is never reported. A notice can rightly tell everyone the same thing, such
as a service outage, so you can keep the code and say why.
What it looks like
send_news sends the same NewsIssue to every member, and NewsIssue is
an EmailMessage.
domains/notes/actions/send_news.jadpo:
use notes/types { Headline }use notes/queries { every_member }use notes/emails { NewsIssue }/// Sends this month's news to every member.action send_news(headline: Headline) -> Unit { for member in every_member() { emit NewsIssue { to: member.email locale: Locale.en_gb headline: headline } }}
error NewsIssue is sent as bulk mail is
--> domains/notes/actions/send_news.jadpo:8:9
|8 | emit NewsIssue { | ^^^^^^^^^^^^^^^^ emitted for each item, the same words to each
- reason
NewsIssueis a transactional email, which tells one person about their own account, and it is emitted for each item of a loop with nothing in it but the address differing from one item to the next: that is bulk mail, which carries a one-click unsubscribe and isn't sent to an address that used it.- next
- Declare
type NewsIssue = BulkEmailMessage { ... }if it is the same news for everyone, or writedecline email.sent_in_bulk: "<why>"above it if this is deliberate (agent) - rule
- email.
sent_ in_ bulk - help
- https://jadpo.
dev/docs/errors/email. sent_ in_ bulk
(agent) at the end of the next: line means your coding agent can make
the fix itself.
How to fix it
If it is news for everyone, declare it as bulk mail. In
domains/notes/emails/news_issue.jadpo:
use notes/types { Headline }/// This month's news, sent to every member.type NewsIssue = BulkEmailMessage { headline: Headline}
It now goes through email: { bulk: }'s connection, with a one-click
unsubscribe, and not to anyone who used it. Its templates write
{{ unsubscribe_link }}, and members who didn't ask for the news are left
out by the query that picks the readers.
If each person needs it, whatever they chose, keep it and say why,
with a decline line above the action. In
domains/notes/actions/send_news.jadpo:
use notes/types { Headline }use notes/queries { every_member }use notes/emails { NewsIssue }/// Sends this month's news to every member.decline email.sent_in_bulk: "The monthly report is part of the service each member's contract includes."action send_news(headline: Headline) -> Unit { for member in every_member() { emit NewsIssue { to: member.email locale: Locale.en_gb headline: headline } }}
The reason is kept with the action for a reviewer to read, and the check passes.
Related
Markdown for agents: /docs/errors/email.sent_in_bulk.md.Built from Jadpo's main branch at commit dfbeede.