Skip to content

Commit 23f9a32

Browse files
authored
fix: user verification email broken (#6442)
## Description Closes [#225](payloadcms/payload-3.0-demo#225). The user verification emails are not being sent and this error is shown: ```ts APIError: Error sending email: 422 validation_error - Invalid `from` field. The email address needs to follow the `email@example.com` or `Name <email@example.com>` format. ``` The issue is resolved by updating the `from` property on the outgoing verification email: ```ts from: `"${email.defaultFromName}" <${email.defaultFromName}>`, // to from: `"${email.defaultFromName}" <${email. defaultFromAddress}>`, ``` **NOTE:** This was not broken in 2.0, see correct outgoing email [here](https://github.com/payloadcms/payload/blob/main/packages/payload/src/auth/sendVerificationEmail.ts#L69). - [X] I have read and understand the [CONTRIBUTING.md](https://github.com/payloadcms/payload/blob/main/CONTRIBUTING.md) document in this repository. ## Type of change - [X] Bug fix (non-breaking change which fixes an issue) ## Checklist: - [X] Existing test suite passes locally with my changes
1 parent 0190eb8 commit 23f9a32

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

packages/payload/src/auth/sendVerificationEmail.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ export async function sendVerificationEmail(args: Args): Promise<void> {
6666

6767
// eslint-disable-next-line @typescript-eslint/no-floating-promises
6868
email.sendEmail({
69-
from: `"${email.defaultFromName}" <${email.defaultFromName}>`,
69+
from: `"${email.defaultFromName}" <${email.defaultFromAddress}>`,
7070
html,
7171
subject,
7272
to: user.email,

0 commit comments

Comments
 (0)