Email subject and sender name option#404
Email subject and sender name option#404ririko5834 wants to merge 2 commits intodwyl:masterfrom ririko5834:patch-1
Conversation
| to: String(sendEmailTo), | ||
| subject: "Contact form submitted", | ||
| name: String(e.parameters.formGoogleEmailSender) || "Contact Form", | ||
| subject: String(e.parameters.formGoogleEmailSubject) || "Contact form submitted", |
There was a problem hiding this comment.
I believe these || ... checks won't get hit in all cases.
If the parameters are null or undefined, (like if someone just updates the backend script here or doesn't give these parameters), then you would end up with String(undefined) = 'undefined' which is not falsey.
It may be worth setting the name / subject above and consider using mailData and/or .toString() when the field is present/truthy.
| // add form-specific values into the data | ||
| formData.formDataNameOrder = JSON.stringify(fields); | ||
| formData.formGoogleSheetName = form.dataset.sheet || "responses"; // default sheet name | ||
| formData.formGoogleEmailSubject = form.dataset.subject || "Contact form was submitted"; //default email subject |
There was a problem hiding this comment.
is it expected that we set the defaults here, or would we want to have a default like the custom email option below?
nitpick: the comment at the end matches L46, but I think it could be cleaner code to consider changing the variable names here to those, if those are better descriptions than what we have as variables in the code.
what do you think?
|
@ririko5834 -- did you have interest in addressing the comments posted here to get this PR merged? or would you prefer we take it from here? :) thanks for your contributions so far!! |
This feature adds option to set email subject and email sender name