Back

Custom Verify Email and Forgot Password Mails

  • 0
  • Self Hosted
  • Accounts
  • Web
boatbxy
12 Jan, 2024, 17:07

I want to use a custom template for my verify email and forgot password mails, and I don’t think Appwrites current template has allowances for what I want to create (a template with images, custom font etc). How can I achieve this?

I tried using a template I created and pass in the data from the createVerification object, but secret keeps returning an empty string

TL;DR
Developers are discussing how to customize the verify email and forgot password mails in Appwrite. One developer shares a link to the documentation for message templates. The question of whether this customization can be done from the console or with a custom SMTP server is raised. Another developer points out that the provided code example is incorrect and suggests using three back ticks for multi-line code. The correct code for customizing the emails is shared. The possibility of adding an image to the custom template is asked, but no response is given. There is confusion about the createVerification object not returning the secret, and it is suggested to define a custom template in the console
Drake
12 Jan, 2024, 17:09

Pass in data from create verification object? What do you mean?

Drake
12 Jan, 2024, 17:09

You should be able to define a custom template in the console after adding a custom project SMTP

boatbxy
12 Jan, 2024, 17:11

I mean, i tried to manually pass in the data returned when you create an email verification (https://appwrite.io/docs/references/cloud/client-web/account#createVerification) but it doesn’t return the secret

Drake
12 Jan, 2024, 17:11

Sorry, I don't understand. Maybe you can share a screenshot or code to give more context?

boatbxy
12 Jan, 2024, 17:12

Can I add an image in this custom template?

boatbxy
12 Jan, 2024, 17:14

const res = await account.createVerification(${BASE_URL}/about); const firstName = user?.name.split(' ')[0]; const redirectLink = ${BASE_URL}/about?userId=${res.userId}&secret=${res.secret}&expire=${res.expire};

TypeScript
  // plug in verification data to template
  await axios.post('/api/welcome-user', {
    to: email,
    title: `Welcome, ${firstName}!`,
    redirectLink,
  });

This is what I mean

Drake
12 Jan, 2024, 17:15

Btw, it's best to use 3 back ticks with multi-line code. See https://www.markdownguide.org/extended-syntax/#syntax-highlighting

Drake
12 Jan, 2024, 17:15

No, that's not how you customize the emails

boatbxy
12 Jan, 2024, 17:16

Noted. Thank you

boatbxy
12 Jan, 2024, 17:16

Is the only way to go about it from the console? With custom a SMTP server?

boatbxy
12 Jan, 2024, 17:17

Alright, thank you

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more