Skip to content

Customized email templates for authentication process #1

@rognierbenoit

Description

@rognierbenoit
  • design email templates (verification, reset password, ...)
  • create firebase functions to catch email sending events

Function should be something like:

const functions = require('firebase-functions');
const admin = require('firebase-admin');
admin.initializeApp();

exports.customizeEmailVerificationEmail = functions.auth.emailAction('email-verification').onCreate((context) => {
  const { email, url } = context.data;

  // Customize the email subject
  const subject = 'Verify Your Email Address';

  // Customize the email body
  const body = `
    Hello,

    Thank you for signing up with our app! To complete your registration, please verify your email address by clicking the link below:

    ${url}

    If you did not request this email verification, please ignore this email.

    Best regards,
    Your App Team
  `;

  // Use the Firebase Admin SDK to send the customized email
  return admin.auth().sendVerificationEmail(email, {
    from: 'no-reply@your-app.com',
    subject: subject,
    body: body,
  });
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions