Skip to content

Commit

Permalink
Merge pull request #23 from ttsukagoshi/Change-prompt-message-for-ent…
Browse files Browse the repository at this point in the history
…ering-subject

Modified prompt message to enter subject
  • Loading branch information
ttsukagoshi authored Jun 12, 2020
2 parents 61e01e6 + 17c6dbc commit dc15e02
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/mailMerge.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ function sendPersonalizedEmails_(draftMode = true, config = CONFIG) {
throw new Error('Mail merge canceled.');
}
// Get template from Gmail draft
let promptMessage = 'Enter the subject text of Gmail draft to use as template.';
let promptMessage = 'Enter the subject of Gmail template draft.';
let promptResult = ui.prompt(promptMessage, ui.ButtonSet.OK_CANCEL);
let [selectedButton, subjectText] = [promptResult.getSelectedButton(), promptResult.getResponseText()];
if (selectedButton !== ui.Button.OK) {
Expand All @@ -97,6 +97,10 @@ function sendPersonalizedEmails_(draftMode = true, config = CONFIG) {
if (draftMessage.length > 1) {
throw new Error('There are 2 or more Gmail drafts with the subject you entered. Enter a unique subject text.');
}
// Throw error if no draft template is found
if (draftMessage.lenth == 0 ){
throw new Error('No template Gmail draft with matching subject found.');
}
// Store template into an object
let template = {
'subject': subjectText,
Expand Down

0 comments on commit dc15e02

Please sign in to comment.