📧Send emails

Send emails docu

Input parameters

  1. to_email_adress

  2. template_name

  3. data (Data will be some other documents defined in each separate API call)

How to call from app

import { httpsCallable } from 'firebase/functions';

await httpsCallable(functions, 'sendEmail')({ 
  to: to_email_adress,  
  template: { 
    name: template_name, 
    data: {taskData: currentTask, taskId: task.id}
  }
});

Logic

1.

emailData = {
  to: to_email_adress
  template: {
    name: template_name
    data: data
  }

2. addDoc(collection(db, "send-emails"), emailData)

Last updated