gmail-mail-merge
gmail-mail-merge copied to clipboard
Trim Error
Message details TypeError: Cannot call method "trim" of undefined.
@brettargh18 @harshjv update getLatestDraft with the below and it will work
function getLatestDraft () { //var drafts = GmailApp.getDraftMessages() var drafts = GmailApp.getDrafts()[0] var message = drafts.getMessage() if (message.length === 0) return null else return message }
Sorry it's not working,getting error: Missing ; before statement. (line 32, file "Code")Dismiss
If you use invalid email (i.e. "email"), gmail will remove it when saving your draft. Either use valid email format (i.e. "[email protected]") as email placeholder (column header) or hardcode it in google script to resolve this issue.
//var emailPlaceHolder = draft.getTo()
var emailPlaceHolder = 'email'
I've made the suggested changes to getLatestDraft but still getting the trim error.
TypeError: Cannot call method "trim" of undefined.
Any idea what the error means? I'm not a coder so it pretty meaningless to me!
I got it working! I also had to make the emailPlaceHolder change. Once I did that it worked.
I'm having the same issues as the guys above - @DervMan or @krnsptr or @patrickacollier would you be able to upload the full code again please?
After making the suggested changes i see an error message 'TypeError: Cannot call method "getSubject" of undefined.' ?
you can try pulling from my branch-> https://github.com/patrickacollier/gmail-mail-merge There's also a change i made to the drafts
https://github.com/patrickacollier/gmail-mail-merge/commit/8e144c2e6a6429faa35cb58445ebb763ec2572f0#diff-a5d3061c9dfd2cc892c25d05230d7cc2
On Tue, Sep 10, 2019 at 8:28 AM John27208 [email protected] wrote:
After making the suggested changes i see an error message 'TypeError: Cannot call method "getSubject" of undefined.' ?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/harshjv/gmail-mail-merge/issues/2?email_source=notifications&email_token=ADLJ3XMNRYNFBTPWFXJ2R53QI6HITA5CNFSM4FIIBQ62YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD6K47VA#issuecomment-529911764, or mute the thread https://github.com/notifications/unsubscribe-auth/ADLJ3XPQUVU5OTIOEMJTVYTQI6HITANCNFSM4FIIBQ6Q .