> ## Documentation Index
> Fetch the complete documentation index at: https://docs.khanhng.com/llms.txt
> Use this file to discover all available pages before exploring further.

# AD-005 Send report emails with Nodemailer

> AD-005 Send report emails with Nodemailer for ReportGeneratorTool.

**Status:** Accepted **Decision date:** 2025-08-01 **Implementation:** Confirmed in the repository at commit `27045ec`.

## Context and decision drivers

After generating a PDF, the service must email it to the recipients supplied in the report request. The expected volume is small. The team wanted a familiar library without adopting a paid email API solely for this workflow.

## Options considered

| Option | Assessment at decision time |
| - | - |
| Nodemailer | A widely used library that sends the PDF attachment through a configured email service without a library fee. |
| Commercial email services | Would add provider cost and an integration that was not justified for the expected volume. No specific provider was recorded as evaluated. |

## Decision and rationale

Use Nodemailer to send the generated PDF as an attachment through the configured email service. Nodemailer itself is free, while the configured service may have its own limits or charges.

## Consequences

* Email delivery remains part of the application workflow.
* The service depends on the configured provider's availability, credentials, and sending limits.
* A successful `sendMail` call does not establish that a recipient received or read the email.
* Credential handling, retry policy, and delivery monitoring need separate operational controls.

## Implementation evidence

The [email service](https://github.com/TQKNG/automation/blob/27045ec413f88cd2227ab08e18ec76db3e8e3d34/src/functions/shared/utils/sendEmailService.js) creates the Nodemailer transport and attaches the PDF. The [email activity](https://github.com/TQKNG/automation/blob/27045ec413f88cd2227ab08e18ec76db3e8e3d34/src/functions/activity_sendEmail.js) retrieves that PDF from Blob Storage.

## Revisit when

Reconsider the delivery approach if volume, deliverability, audit, retry, or provider limits require a dedicated email service.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.