Skip to main content

Provide SMTP configuration

Using this method, you can:

  • Send emails using your own domain
  • Optionally customise the default email templates and subject.
import supertokens from "supertokens-node";
import ThirdParty from "supertokens-node/recipe/thirdparty";
import Session from "supertokens-node/recipe/session";
import EmailVerification from "supertokens-node/recipe/emailverification"
import { SMTPService as EmailVerificationSMTPService } from "supertokens-node/recipe/emailverification/emaildelivery";

let smtpSettings = {
host: "...",
authUsername: "...", // this is optional. In case not given, from.email will be used
password: "...",
port: 465,
from: {
name: "...",
email: "...",
},
secure: true
}

supertokens.init({
appInfo: {
apiDomain: "...",
appName: "...",
websiteDomain: "..."
},
recipeList: [
ThirdParty.init({
}),

// if email verificaiton is enabled..
EmailVerification.init({
emailDelivery: {
service: new EmailVerificationSMTPService({smtpSettings})
}
}),
Session.init()
]
});

To learn about how to customise the default email templates or the subject, please see the next section.

Which frontend SDK do you use?
supertokens-web-js / mobile
supertokens-auth-react