Before You Start¶
Sending needs three things your DBA sets up once — see the DBA Guide if you're setting these up yourself.
- A profile — a named delivery endpoint (an SMTP relay or a Microsoft 365 tenant). Examples throughout this guide use
'mailer'; ask your DBA for the profile name(s) available to you. - A channel — the pg_relay queue lane a profile dispatches through. You rarely need to think about it; every profile has a default.
- Access — your role needs the sender grant (
pgrelay_notifier.grant_sender('your_role'), superuser-run). With it you can send and inspect status; you cannot manage profiles or purge data.
Quick sanity check¶
Confirm you're connected to a working install and can reach the interface:
If this raises a permission error, you're missing the sender grant — ask your DBA. If the function doesn't exist at all, the extension isn't installed in this database.
Do you even need to name a profile?¶
Not always. If your DBA has configured a database-wide default profile (pg_relay_notifier.default_profile, set via pgrelay.set_option), pass NULL (or '') as p_profile and it resolves automatically. p_profile is a required argument on every function that takes one — you always pass something — but that something can be NULL. See Profile Defaults.