Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Email subject and sender name option #404

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
ririko5834 wants to merge 2 commits into dwyl:master
base: master
Choose a base branch
Loading
from ririko5834:patch-1
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Update google-apps-script.js
  • Loading branch information
ririko5834 authored Apr 28, 2021
commit f1a30d9234e753cd13edc3b877d28d44922fd34e
3 changes: 2 additions & 1 deletion google-apps-script.js
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ function doPost(e) {
if (sendEmailTo) {
MailApp.sendEmail({
to: String(sendEmailTo),
subject: "Contact form submitted",
name: String(e.parameters.formGoogleEmailSender) || "Contact Form",
subject: String(e.parameters.formGoogleEmailSubject) || "Contact form submitted",
Copy link
Collaborator

@mckennapsean mckennapsean Aug 15, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

nelsonic reacted with thumbs up emoji
// replyTo: String(mailData.email), // This is optional and reliant on your form actually collecting a field named `email`
htmlBody: formatMailBody(mailData, dataOrder)
});
Expand Down

AltStyle によって変換されたページ (->オリジナル) /