payloadcms / payload-3.0-demo

The official demo for Payload 3.0
https://next-payload-3-0-test.vercel.app
483 stars 162 forks source link

BUG + FIX - Verification email uses defaultFromName instead of defaultFromEmail #225

Closed mcornielje090404 closed 5 months ago

mcornielje090404 commented 5 months ago

Hey,

I've been using the verify email flow from Payload and noticed that there's a bug with the way the verification email is sent.

When sending an email it is failing because the "address" used is the name passed into the email provider. This (in my use case) is causing Resend to block the email because it's not from a valid domain.

I've identified it to be in the file packages/payload/src/auth/sendVerificationEmail.ts

I believe you should just have to change the sendEmail function call at line 68 from

email.sendEmail({
      from: `"${email.defaultFromName}" <${email.defaultFromName}>`,
      html,
      subject,
      to: user.email
})

To:

email.sendEmail({
      from: `"${email.defaultFromName}" <${email. defaultFromAddress}>`,
      html,
      subject,
      to: user.email
})
mcornielje090404 commented 5 months ago

Btw is there any way to make PR's to payload from outside the org? I'd happily raise a PR resolving this myself if possible.

JessChowdhury commented 5 months ago

@mcornielje090404 you can absolutely make a PR directly to Payload by forking the main repo here. Check out our contributing guidelines for some extra info when it comes to opening a PR.

I'll take a look at this issue too.