Skip to Content
JavaScriptJs Sending Emails

Last Updated: 3/9/2026


PocketBase v0.36.6

Sending emails

PocketBase provides a simple abstraction for sending emails via the $app.newMailClient() helper.

Depending on your configured mail settings (Dashboard > Settings > Mail settings) it will use the sendmail command or a SMTP client.

Send custom email

You can send your own custom emails from everywhere within the app (hooks, middlewares, routes, etc.) by using $app.newMailClient().send(message). Here is an example of sending a custom email after user registration:

onRecordCreateRequest(() =>{. next() const = new MailerMessage({:{:.. settings()..,:.. settings()..,},:[{:.. email()}],:"YOUR_SUBJECT...",:"YOUR_HTML_BODY...",// bcc, cc and custom headers are also supported...}).. newMailClient(). send()}, "users")

Overwrite system emails

If you want to overwrite the default system emails for forgotten password, verification, etc., you can adjust the default templates available from the Dashboard > Collections > Edit collection > Options .

Alternatively, you can also apply individual changes by binding to one of the mailer hooks. Here is an example of appending a Record field value to the subject using the onMailerRecordPasswordResetSend hook:

onMailerRecordPasswordResetSend((e) =>{// modify the subject.. +=(" " +.. get("name")). next()})


Prev: Jobs scheduling Next: Rendering templates