-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add send form contact mail endpoint
- Loading branch information
Showing
5 changed files
with
80 additions
and
10 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,18 @@ | ||
module.exports = { | ||
'candidature-partenaire-de-la-charte': { | ||
from: process.env.SMTP_FROM || '[email protected]', | ||
to: '[email protected]', | ||
subject: 'Nouvelle candidature aux partenaires de la charte', | ||
"candidature-partenaire-de-la-charte": { | ||
from: process.env.SMTP_FROM || "[email protected]", | ||
to: "[email protected]", | ||
subject: "Nouvelle candidature aux partenaires de la charte", | ||
text: `Bonjour,\n\nUne nouvelle candidature aux partenaires de la charte a été soumise.\n\nVous pouvez la consulter sur <a href="${process.env.NEXT_PUBLIC_BAL_ADMIN_URL}/partenaires-de-la-charte?tab=candidatures">BAL Admin</a>.\n\nBonne journée,\n\nL’équipe BAL`, | ||
html: `<p>Bonjour,</p><p>Une nouvelle candidature aux partenaires de la charte a été soumise.</p><p>Vous pouvez la consulter sur <a href="${process.env.NEXT_PUBLIC_BAL_ADMIN_URL}/partenaires-de-la-charte?tab=candidatures">BAL Admin</a>.</p><p>Bonne journée,</p><p>L’équipe BAL</p>` | ||
} | ||
} | ||
html: `<p>Bonjour,</p><p>Une nouvelle candidature aux partenaires de la charte a été soumise.</p><p>Vous pouvez la consulter sur <a href="${process.env.NEXT_PUBLIC_BAL_ADMIN_URL}/partenaires-de-la-charte?tab=candidatures">BAL Admin</a>.</p><p>Bonne journée,</p><p>L’équipe BAL</p>`, | ||
}, | ||
contact: ({ firstName, lastName, email, message, subject }) => { | ||
return { | ||
from: process.env.SMTP_FROM || "[email protected]", | ||
to: "[email protected]", | ||
subject, | ||
text: `Bonjour,\n\nVous avez reçu un nouveau message via le formulaire de contact de BAL Widget.\n\nNom: ${lastName}\nPrénom: ${firstName}\nEmail: ${email}\n\nMessage:\n${message}\n\nBonne journée,\n\nL’équipe BAL`, | ||
html: `<p>Bonjour,</p><p>Vous avez reçu un nouveau message via le formulaire de contact de la BAL Widget.</p><p>Nom: ${lastName}</p><p>Prénom: ${firstName}</p><p>Email: ${email}</p><p>Message:</p><p>${message}</p><p>Bonne journée,</p><p>L’équipe BAL</p>` | ||
}; | ||
}, | ||
}; |
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,14 @@ | ||
const { validEmail } = require("../../utils/payload"); | ||
|
||
const mailSchema = { | ||
firstName: { isRequired: false, type: "string" }, | ||
lastName: { isRequired: false, type: "string" }, | ||
email: { valid: validEmail, isRequired: true, type: "string" }, | ||
message: { isRequired: true, type: "string" }, | ||
subject: { isRequired: true, type: "string" }, | ||
reCaptchaToken: { isRequired: true, type: "string" }, | ||
}; | ||
|
||
module.exports = { | ||
mailSchema, | ||
}; |
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