-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support email configuration in payload config (#2485)
* feat: support email configuration in payload config * feat: set email defaults if no email config * chore: leftover line from testing * feat: add warning if email configure in both init and config
- Loading branch information
Showing
6 changed files
with
36 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { EmailOptions } from '../config/types'; | ||
|
||
export const defaults: EmailOptions = { | ||
fromName: 'Payload CMS', | ||
fromAddress: '[email protected]', | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,8 @@ import nodemailer from 'nodemailer'; | |
import { EmailOptions } from '../config/types'; | ||
import { MockEmailHandler } from './types'; | ||
|
||
import { defaults as emailDefaults } from './defaults'; | ||
|
||
const mockEmailHandler = async (emailConfig: EmailOptions): Promise<MockEmailHandler> => { | ||
const testAccount = await nodemailer.createTestAccount(); | ||
|
||
|
@@ -10,8 +12,8 @@ const mockEmailHandler = async (emailConfig: EmailOptions): Promise<MockEmailHan | |
host: 'smtp.ethereal.email', | ||
port: 587, | ||
secure: false, | ||
fromName: emailConfig.fromName || 'Payload CMS', | ||
fromAddress: emailConfig.fromAddress || '[email protected]', | ||
fromName: emailConfig?.fromName || emailDefaults.fromName, | ||
fromAddress: emailConfig?.fromAddress || emailDefaults.fromAddress, | ||
auth: { | ||
user: testAccount.user, | ||
pass: testAccount.pass, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters