Implement a real email transport in the email queue processor
Description
processEmailNotification in src/queue/processors/email-processor.ts does not send email — it validates subject/body, then calls simulateEmailSend, which only console.logs the payload and resolves after a 100ms setTimeout. The function returns { success: true } regardless, so every queued email job "succeeds" while nothing is delivered. The inline comments explicitly say "replace with actual email service integration" (SendGrid, AWS SES, etc.). This issue wires a real, injectable email transport so queued notifications are actually delivered.
Requirements and context
- Repository scope: Talenttrust/Talenttrust-Backend only.
- Introduce an
EmailTransport interface so a real provider (SMTP/SendGrid/SES) can be configured and a mock injected in tests; select the transport from validated config in src/config/env.schema.ts.
- Replace
simulateEmailSend with a real dispatch that surfaces provider failures so the job fails (and is retried) instead of silently succeeding.
- Validate the recipient
to with a strict email check and guard against header injection before dispatch.
- Keep the existing return shape
{ success, message, data: { emailId } } and the job-failure semantics expected by the queue manager in src/queue/queue-manager.ts.
- Do not log full recipient addresses or bodies at info level; route through the structured logger in
src/logger.ts.
Suggested execution
- Fork the repo and create a branch
git checkout -b feature/queue-31-email-transport
- Implement changes
- Write code in:
src/queue/processors/email-processor.ts and create src/queue/processors/email.transport.ts.
- Write comprehensive tests in:
src/queue/processors/email-processor.test.ts — mock the transport and assert delivery, provider-failure propagation, and recipient validation.
- Add documentation: create
docs/email-notifications.md describing transport selection and config.
- Add TSDoc to the new interface and dispatch method.
- Validate security: header-injection guard, no PII in logs.
- Test and commit
Test and commit
- Run
npm run lint and npm test.
- Cover edge cases: missing subject/body, invalid recipient, transport throws, transport timeout.
- Include the full
npm test output and notes in the PR.
Example commit message
feat(queue): implement real email transport in the email processor
Guidelines
- Minimum 95 percent test coverage for impacted modules.
- Clear, reviewer-focused documentation.
- Timeframe: 96 hours.
Community & contribution rewards
- 💬 Join the TalentTrust community on Discord for questions, reviews, and faster merges: https://discord.gg/WqnGpcPx
- ⭐ This is a GrantFox OSS / Official Campaign task and may be rewarded. When your PR is merged you'll be prompted to rate the project — if this issue and the maintainers helped you ship, we'd be grateful for a 5-star rating. Clear questions in Discord and tidy, well-tested PRs are the fastest path to a merge and a reward.
Implement a real email transport in the email queue processor
Description
processEmailNotificationinsrc/queue/processors/email-processor.tsdoes not send email — it validatessubject/body, then callssimulateEmailSend, which onlyconsole.logs the payload and resolves after a 100mssetTimeout. The function returns{ success: true }regardless, so every queued email job "succeeds" while nothing is delivered. The inline comments explicitly say "replace with actual email service integration" (SendGrid, AWS SES, etc.). This issue wires a real, injectable email transport so queued notifications are actually delivered.Requirements and context
EmailTransportinterface so a real provider (SMTP/SendGrid/SES) can be configured and a mock injected in tests; select the transport from validated config insrc/config/env.schema.ts.simulateEmailSendwith a real dispatch that surfaces provider failures so the job fails (and is retried) instead of silently succeeding.towith a strict email check and guard against header injection before dispatch.{ success, message, data: { emailId } }and the job-failure semantics expected by the queue manager insrc/queue/queue-manager.ts.src/logger.ts.Suggested execution
git checkout -b feature/queue-31-email-transportsrc/queue/processors/email-processor.tsand createsrc/queue/processors/email.transport.ts.src/queue/processors/email-processor.test.ts— mock the transport and assert delivery, provider-failure propagation, and recipient validation.docs/email-notifications.mddescribing transport selection and config.Test and commit
npm run lintandnpm test.npm testoutput and notes in the PR.Example commit message
feat(queue): implement real email transport in the email processorGuidelines
Community & contribution rewards