Skip to main content

Email Service

Every cloud function has access to a fully managed email service. No setup required — just use the email global and Cocobase handles the rest.

Provider Priority

Cocobase automatically selects the best available email provider for your project:
  1. Project Integration (CocoMailer / Resend / EmailJS)
  2. SMTP Configuration (your own SMTP server)
  3. Cocobase Fallback (managed Resend via noreply@cocobase.cc)
Configure your preferred provider once in the dashboard and all email calls use it automatically.

Two Ways to Send Email

1. req.send_mail() — Quick Send

Best for simple one-off emails:

2. email.* — Full Email Service

The email global is pre-injected into every cloud function — no imports needed.

Email Methods

Send Generic Email

Send Welcome Email

Send Password Reset Email

Send Password Changed Confirmation

Send 2FA Code Email

Error Handling

Note: send_welcome_email silently suppresses errors so registration is never blocked. All other methods raise on failure — always wrap in try/except.

Email Logging

Every email sent is automatically logged in your dashboard under Email → Logs. Each entry records recipients, subject, template used, status (PENDING → SENT or FAILED), and timestamp.