Quickstarty

Quickstart: E-mail

Dodaj domenę nadawcy i wyślij pierwszą wiadomość.

Transakcyjny serwis e-mail ma API w stylu Resend (klucze hbe_…).

Zmienne w przykładach: $HOSTBASE_TOKEN (token dostępu), $REF (ref projektu). SDK: @hostbase/management (TypeScript) i hostbase_management (Python), pełne API: /docs/api.

1. Dodaj domenę

W odpowiedzi dostaniesz rekordy DNS (SPF, DKIM, DMARC).

curl -X POST https://host.ulewicz.space/api/v1/projects/$REF/email/domains -H "Authorization: Bearer $HOSTBASE_TOKEN" -H "Content-Type: application/json" -d '{"domain":"mail.example.com"}'
await hb.addEmailDomain({ ref, body: { domain: "mail.example.com" } });
hb.add_email_domain(ref=ref, body={"domain": "mail.example.com"})

2. Zweryfikuj

Po ustawieniu DNS sprawdź domenę ponownie.

curl -X POST https://host.ulewicz.space/api/v1/projects/$REF/email/domains -H "Authorization: Bearer $HOSTBASE_TOKEN" -H "Content-Type: application/json" -d '{"domain":"mail.example.com","verify":true}'
await hb.addEmailDomain({ ref, body: { domain: "mail.example.com", verify: true } });
hb.add_email_domain(ref=ref, body={"domain": "mail.example.com", "verify": True})

3. Wyślij

Klucz API (hbe_…) utworzysz w panelu; opcjonalny nagłówek Idempotency-Key.

curl -X POST https://host.ulewicz.space/api/email/v1/send -H "Authorization: Bearer $HBE_KEY" -H "Content-Type: application/json" \
  -d '{"from":"App <hi@mail.example.com>","to":["jan@example.com"],"subject":"Hello","html":"<p>It works</p>"}'
await fetch("https://host.ulewicz.space/api/email/v1/send", {
  method: "POST",
  headers: { Authorization: `Bearer ${process.env.HBE_KEY}`, "Content-Type": "application/json" },
  body: JSON.stringify({ from: "App <hi@mail.example.com>", to: ["jan@example.com"], subject: "Hello", html: "<p>It works</p>" }),
});
import requests
requests.post("https://host.ulewicz.space/api/email/v1/send", headers={"Authorization": f"Bearer {HBE_KEY}"},
  json={"from": "App <hi@mail.example.com>", "to": ["jan@example.com"], "subject": "Hello", "html": "<p>It works</p>"})

Dalej: /docs/limity-api.