Skip to content

How to use resend.com api for sending emails? #2966

Answered by ganigeorgiev
Demoevery asked this question in Q&A
Discussion options

You must be logged in to vote

In order to use the builtin PocketBase email client (see "Sending custom emails") you need a provider that supports SMTP.

Looking at Resend API documentation there is no mention for SMTP so I'm not sure if it is supported.

In general you can initialize their SDK client as shown in your example. To intercept the system emails action (eg. for password reset) you can attach to the specific OnMailer* hook and return hook.StopPropagation. Something like:

package main

import (
    "log"

    "github.com/pocketbase/pocketbase"
    "github.com/pocketbase/pocketbase/core"
    "github.com/pocketbase/pocketbase/tools/hook"
)

func main() {
    app := pocketbase.New()

    app.OnMailerBeforeRecordRe…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@Demoevery
Comment options

@ganigeorgiev
Comment options

Answer selected by Demoevery
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants