Hello, Do you have any idea about how to add our own custom email sending functionalities for verify email and forgot password auth operations ?
Right now, we are doing the email configuraton in payload.init .
We don't want do it. So, We have to write our own email sending functionalities and configure with verify email and forgot password functionalities.
Do you have the solution , feel free to share . Thanks
Good morning @Veera26
On Auth-enbabled collections, you can override the generated email with something custom
https://payloadcms.com/docs/authentication/config#forgot-password
import { CollectionConfig } from 'payload/types';
export const Customers: CollectionConfig = {
slug: 'customers',
auth: {
forgotPassword: {
generateEmailHTML: ({ req, token, user }) => {
// Use the token provided to allow your user to reset their password
const resetPasswordURL = `https://yourfrontend.com/reset-password?token=${token}`;
return `
<!doctype html>
<html>
<body>
<h1>Here is my custom email template!</h1>
<p>Hello, ${user.email}!</p>
<p>Click below to reset your password.</p>
<p>
<a href="${resetPasswordURL}">${resetPasswordURL}</a>
</p>
</body>
</html>
`;
}
}
}
};
Okay
is there a way to disable the mockTransport email configuration ?
Hmm, I think you can disable it by setting logMockCredentials to false -
https://payloadcms.com/docs/email/overview#mock-transportStar
Discord
online
Get help straight from the Payload team with an Enterprise License.