Sends one user's welcome email, after the confirmation that enqueued it has
committed. See PhoenixKit.Users.WelcomeEmail.
Job args
%{"user_uuid" => "<uuid>"}What a run does
- Nothing, when the welcome email has been switched off since, or the
user is gone. A deactivated user (
is_activefalse) gets nothing either, with a line in the log. - Claims the account: one conditional
UPDATEwriteswelcome_email_sent_atintocustom_fieldsonly where it is absent and the address is confirmed. No row updated means it was sent already, or the address is no longer confirmed — done. - Builds the message, then hands it to the mailer.
At most once
The mark is cleared — and the job retried — only when the message is known
not to have gone out: building it failed (rendering, a template, the
provider; raised, thrown or exited), or the mailer reported that it was not
sent ({:error, reason}). A raise or exit during delivery leaves it unknown
whether the message went out, so the mark stays, the error is logged and
the job is cancelled rather than retried. So is a node that dies between
the claim and the send: that welcome email is lost. Both are deliberate —
a missing welcome email is a smaller harm than a second one.