# Send emails

### 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)
