Website: deliver contact form submission via email (#20972)

Closes: #20904

Changes:
- Updated the `deliver-contact-form-message` action to send contact form
submissions to Fleet's support email address.
- Added an email template for contact form messages.
This commit is contained in:
Eric
2024-08-27 15:43:20 -05:00
committed by GitHub
parent fae3dec60f
commit 01225dbba7
5 changed files with 58 additions and 5 deletions
@@ -155,6 +155,14 @@ module.exports = {
notes: 'Fake organization 2 is looking for a managed cloud MDM solution with a name that ends with "eet"',
};
break;
case 'email-contact-form':
fakeData = {
firstName: 'Jane',
lastName: 'Williamson',
emailAddress: 'jane@example.com',
message: 'Hi, this is a contact form message!',
};
break;
default:
layout = 'layout-email-newsletter';
fakeData = {
+20 -3
View File
@@ -66,9 +66,26 @@ module.exports = {
throw 'invalidEmailDomain';
}
await sails.helpers.http.post(sails.config.custom.slackWebhookUrlForContactForm, {
text: `New contact form message: (Remember: we have to email back; can't just reply to this thread.) cc @sales `+
`Name: ${firstName + ' ' + lastName}, Email: ${emailAddress}, Message: ${message ? message : 'No message.'}`
// await sails.helpers.http.post(sails.config.custom.slackWebhookUrlForContactForm, {
// text: `New contact form message: (Remember: we have to email back; can't just reply to this thread.) cc @sales `+
// `Name: ${firstName + ' ' + lastName}, Email: ${emailAddress}, Message: ${message ? message : 'No message.'}`
// });
await sails.helpers.sendTemplateEmail.with({
to: sails.config.custom.fromEmailAddress,
replyTo: {
name: firstName + ' '+ lastName,
email: emailAddress,
},
subject: 'New contact form message',
layout: false,
template: 'email-contact-form',
templateData: {
emailAddress,
firstName,
lastName,
message,
},
});
sails.helpers.salesforce.updateOrCreateContactAndAccount.with({
+14 -1
View File
@@ -55,6 +55,18 @@ module.exports = {
example: 'Nola Thacker',
},
replyTo: {
description: 'The reply to email address.',
example: {
email: 'anne.m.martin@example.com',
name: 'Anne M. Martin'
},
type: {
name: 'string',
email: 'string',
}
},
subject: {
description: 'The subject of the email.',
example: 'Hello there.',
@@ -122,7 +134,7 @@ module.exports = {
},
fn: async function({template, templateData, to, toName, subject, from, fromName, layout, ensureAck, bcc, attachments}) {
fn: async function({template, templateData, to, toName, subject, from, fromName, layout, replyTo, ensureAck, bcc, attachments}) {
var path = require('path');
var url = require('url');
@@ -247,6 +259,7 @@ module.exports = {
subject: subjectLinePrefix+subject,
from: from,
fromName: fromName,
replyTo: replyTo,
attachments
};