brevo
Set up Brevo (Sendinblue) email sending for your domains: add the DNS records in Cloudflare, authenticate the domains, and monitor Brevo credits
- Command:
/go/brevo - Category: Email
- Required option: None
- Output: Progress messages
- Last updated: 2026-11-20
On this page: Overview · Quick start · Syntax · Options · Output · Examples · Troubleshooting · Details · See also
Overview
/go/brevo connects your hosted domains to Brevo, a transactional email service used as an SMTP relay. It:
- adds the Brevo DKIM, DMARC, and verification records to each domain's DNS zone in Cloudflare
- registers each domain with Brevo and asks Brevo to authenticate it
- checks the Brevo credit balance and turns the Brevo relay off if mail is not being sent through it
- writes the Brevo API key to the config file used by the GoAdmio panel
Run without a domain, it processes every main domain on the server. Subdomains are skipped.
Before you start
| Requirement | Where it is read from |
|---|---|
| Brevo API key | BrevoAPIKey in the Config table of /var/lib/sqlite/config.db |
| Cloudflare account ID and API token | CloudflareAccountID and CloudflareAPIToken in the same table |
| The domain's DNS zone in that Cloudflare account | Cloudflare |
| The server's IP in Brevo's authorised IPs | https://app.brevo.com/security/authorised_ips |
jq installed |
Used to read the Brevo and Cloudflare responses |
mailx installed |
Used only by check |
Quick start
# Set up one domain
/go/brevo example.com
# Set up every main domain on the server
/go/brevo
Syntax
/go/brevo [domain]
/go/brevo check
/go/brevo config
/go/brevo auth
If you run it without root, it re-runs itself with sudo.
Options
| Form | What it does |
|---|---|
/go/brevo <domain> |
Sets up one domain. Any first argument that contains a dot is treated as a domain. |
/go/brevo |
Sets up every main domain in /home. |
/go/brevo check |
Checks the Brevo credit balance and disables the Brevo relay if it is not being used. |
/go/brevo config |
Writes the Brevo API key to /usr/local/goadmio/include/config/brevo.php. |
/go/brevo auth |
Asks Brevo to authenticate every main domain, without changing DNS. |
[!WARNING] Any first argument that is not
check,config,auth, or a name with a dot runs the full setup for all domains. A typo such aschekdoes not stop; it starts the all-domains run.
Output
The command prints progress for each step, and the raw Brevo API response for auth. It does not print a final summary. Each run also adds a line to /var/log/go/brevo.log.
| Message | Meaning |
|---|---|
[] example.com |
Setup started for this domain. |
Found _dmarc record with ID: <id> |
An existing DMARC record is being removed. |
Successfully deleted _dmarc record |
The old DMARC record was removed. |
Failed to delete _dmarc record |
Cloudflare refused the delete. The response follows. |
No _dmarc record found for example.com |
There was no DMARC record to remove. |
Brevo Working | Credits (<n>)... |
check: the credit balance changed, so Brevo is in use. |
Message Sent | Brevo Working | Credits (<n>)... |
check: the test message used a credit. |
Deactivate Brevo... |
check: the test message did not use a credit, so the Brevo relay was turned off. |
The check, config, and auth forms always exit with status 1, including on success. Do not use their exit status to detect errors.
Examples
# Set up one domain
/go/brevo example.com
# Set up every main domain
/go/brevo
# Check credits and disable Brevo if it is not working
/go/brevo check
# Write the API key for the GoAdmio panel
/go/brevo config
# Authenticate all main domains again, for example after DNS has propagated
/go/brevo auth
Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
| No DNS records are created and nothing is reported | The domain's zone was not found in Cloudflare, so the Zone ID is empty. | Check the Cloudflare account ID and token, and that the domain is in that account. |
| Records are created but Brevo shows the domain as not authenticated | DNS has not propagated yet, or the verification record is missing. | Wait a few minutes, then run /go/brevo auth. |
| The verification TXT record is missing on some domains | See Known issues. | Run /go/brevo <domain> for those domains one at a time. |
| Brevo API calls are refused | The server's IP is not in Brevo's authorised IPs. | Add it at https://app.brevo.com/security/authorised_ips. |
| A subdomain was not set up | /go/brevo without a domain skips subdomains. |
Pass the subdomain explicitly: /go/brevo sub.example.com. |
The Brevo relay was turned off after check |
The test message did not use a credit. | Check the SMTP settings and the Brevo account, then enable the relay again. |
check does nothing |
No Brevo API key is saved, or no mail account has sent mail today. | Save the API key, and run it again later in the day. |
| Existing DMARC policy was replaced | Setup always replaces the _dmarc record. |
Set your own policy again with dmarc. |
Details
Domain setup
For each domain, the command does the following:
-
Looks up the domain's Zone ID in Cloudflare.
-
Deletes the existing
_dmarcTXT record. This runs twice, to remove a duplicate. -
Adds two DKIM CNAME records (TTL 3600, not proxied):
Name Points to brevo1._domainkeyb1.<domain-with-dashes>.dkim.brevo.combrevo2._domainkeyb2.<domain-with-dashes>.dkim.brevo.comIn
<domain-with-dashes>, dots are replaced by dashes (example.combecomesexample-com). -
Adds a
_dmarcTXT record:v=DMARC1; p=none; rua=mailto:rua@dmarc.brevo.com. -
Registers the domain with Brevo and reads its verification code.
-
Adds the verification code as a TXT record on the domain (
@). -
Asks Brevo to authenticate the domain. If Brevo answers that it cannot yet, waits 10 seconds and tries once more.
Record creation is silent. A record that already exists is not reported as an error.
Which domains are processed
Without a domain, the command goes through every directory in /home whose name contains a dot, and keeps the main domains. A domain with one dot (example.com) is a main domain. For longer names, the command removes known two-part endings such as .co.uk or .com.au and treats the name as a subdomain if a dot remains.
check
- Reads the stored credit value and the current credits from the Brevo account.
- If they differ, prints the new value and saves it. Brevo is working.
- If they are the same, picks the mail account that has sent the most mail today and sends a test message from it through the server's mail relay.
- Waits 3 seconds and reads the credits again.
- If the credits are still the same, sets
Active=0for every SMTP relay withbrevo.comin its host in/var/lib/sqlite/smtp.db, then rebuilds the mail maps withvmail. - Otherwise, saves the new credit value.
It is meant to be run on a schedule, for example from cron.
config
Writes a small PHP file that defines $BrevoAPIKey, and sets the file permission to 777. The panel reads the key from this file.
Known issues
- Test address:
checksends its test message to a fixed address,gbp.uae@gmail.com, written in the script. Change it to an address you control. - World-writable key file:
configsets777on a file that contains the API key. Use a stricter permission such as640. - Verification code reuse: after the first domain, the script skips registering the domain with Brevo and then reads the code from the previous response. In an all-domains run, the verification record may be missing for later domains.
- DMARC replaced: an existing
_dmarcpolicy is deleted and replaced withp=none. - Typos run everything: see the warning under Options.
- Empty counter: the progress lines show
[]because the counter variable is never set. - Unused values: the server IP, the mail password, and the domain count are read but not used.
See also
| Command | Description |
|---|---|
dmarc |
Add a DMARC TXT record in Cloudflare (auto-generated or custom value) |
dkim |
Add a DKIM TXT record in Cloudflare (auto-generated or custom value) |
spf |
Add or refresh the SPF TXT record via Cloudflare |
cloudflare |
Manage DNS records using Cloudflare's API |
smtp |
Manage the SMTP port: block, unblock, and change it |
vmail |
Rebuild the Postfix/Dovecot vmail maps |
troubleshoot |
Troubleshoot email problems in GoAdmio |