Skip to content
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

Leaving cc field blank in metadata sheet but populating in merge sheet causes invalid email error #13

Open
benkloester opened this issue Apr 15, 2021 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@benkloester
Copy link

If I do not populate the (per-merge) CC field in the Metadata sheet, but do use (per-email) CC in my merge sheet, then I will end up with a CC value something like undefined, <[email protected]> and when I call MailApp.sendEmail it will throw an invalid email error.

The problem appears to be on line 211:
const cachedCC = msgOptionsHash['cc']; - this is undefined in the case that CC in the metadata sheet wasn't populated. msgOptionsHas will only have a cc attribute at all if it is set, on line 154:if (cc != "") { msgOptionsHash['cc'] = cc; }, if the CC field is populated in the metadata sheet.

So when that undefined cc value gets cached at 211 it gets cached as undefined, and restored as such at 238, then the per-email cc gets appended to that undefined.

@knmnyn knmnyn added the bug Something isn't working label Apr 17, 2021
@knmnyn knmnyn self-assigned this Apr 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants