@saflib/email
@saflib/email
Classes
Class | Description |
---|---|
EmailClient | A simplified client for sending emails, wrapping around nodemailer (or a mock in during tests). |
Interfaces
Interface | Description |
---|---|
EmailOptions | Accepted options when sending an email. A subset of what nodemailer accepts. See Nodemailer docs for more details. |
EmailResult | Result of sending an email. This seems to be what is returned by nodemailer when the transport is SMTP. These types may not be correct if configured to use some other transport. |
EmailsRouterOptions | - |
SentEmail | A record of an email that was sent. Only used for mocking. |
Variables
Variable | Description |
---|---|
emailClient | Global instance of the email client. Since the config is loaded by the environment, and services shouldn't try to set up multiple SMTP connections, this can be a singleton. |
mockingOn | Whether the email client is currently being mocked, and emails are being saved to sentEmails . |
sentEmails | An array of emails that were sent by this service. Only used for mocking. |
Functions
Function | Description |
---|---|
createEmailsRouter | Creates an Express router that can be used to access sent emails. Only used for E2E testing. |