Skip to main content
AI Mentor mengirim email (invite peserta, notifikasi) lewat Resend. Kalau RESEND_API_KEY kosong, pengiriman di-skip — app tetap jalan.
Logo Resend
Dashboard: resend.com
Docs: resend.com/docs

Env di project

RESEND_API_KEY=re_xxxxxxxx
EMAIL_FROM=AI Mentor <noreply@sertifikasitrainer.com>
Kode: apps/api/src/email/email.service.ts

Setup lengkap

1

Daftar akun

Buat akun di resend.com
2

Tambah & verifikasi domain

Dashboard → DomainsAdd Domain → masukkan sertifikasitrainer.com (atau subdomain mail.)Tambahkan record DNS yang ditampilkan Resend (biasanya):
  • SPF (TXT)
  • DKIM (CNAME resend._domainkey)
  • DMARC (TXT, opsional tapi disarankan)
DNS bisa diatur di Cloudflare DNS (zone yang sama dengan domain utama).
3

Verifikasi

Klik Verify DNS Records di Resend. Propagasi bisa 5 menit–24 jam.
4

Buat API key

Dashboard → API KeysCreate API Key
  • Nama: mis. trainerhub-prod
  • Permission: Sending access (cukup untuk production)
  • Scope domain: sertifikasitrainer.com (lebih aman)
Salin key re_...hanya ditampilkan sekali.
5

Tes kirim

curl -X POST 'https://api.resend.com/emails' \
  -H "Authorization: Bearer re_xxx" \
  -H "Content-Type: application/json" \
  -d '{
    "from": "AI Mentor <noreply@sertifikasitrainer.com>",
    "to": ["email-kamu@gmail.com"],
    "subject": "Tes Resend",
    "html": "<p>Hello dari TrainerHub</p>"
  }'
Cek tab Emails di dashboard untuk status delivery.
6

Masukkan ke .env

./thub env merge
./thub secrets push   # production

Tanpa domain terverifikasi (dev saja)

Resend menyediakan domain sandbox onboarding@resend.dev untuk testing — jangan dipakai production. Untuk production wajib domain verified.

Troubleshooting

MasalahSolusi
Email tidak sampaiCek spam; pastikan SPF/DKIM hijau di Resend
403 dari APIKey salah atau permission bukan Sending
From address rejectedEMAIL_FROM harus domain yang sudah verified
[EmailService] skippingRESEND_API_KEY kosong di merged env
Docs: Create API key · Managing domains