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

Trim Error #2

Open
brettargh18 opened this issue Jul 4, 2018 · 9 comments
Open

Trim Error #2

brettargh18 opened this issue Jul 4, 2018 · 9 comments

Comments

@brettargh18
Copy link

Message details
TypeError: Cannot call method "trim" of undefined.

@patrickacollier
Copy link

@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 }

@03sarath
Copy link

Sorry it's not working,getting error: Missing ; before statement. (line 32, file "Code")Dismiss

@krnsptr
Copy link

krnsptr commented Nov 10, 2018

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'

@DervMan
Copy link

DervMan commented May 23, 2019

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!

@DervMan
Copy link

DervMan commented May 23, 2019

I got it working! I also had to make the emailPlaceHolder change. Once I did that it worked.

@John27208
Copy link

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?

@John27208
Copy link

After making the suggested changes i see an error message 'TypeError: Cannot call method "getSubject" of undefined.' ?

@patrickacollier
Copy link

patrickacollier commented Mar 12, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants
@brettargh18 @patrickacollier @krnsptr @DervMan @03sarath @John27208 and others