Lex Wilkins
Lex Wilkins

Reputation: 1

Google Apps Script - check if an email has sent properly

I'm working on a Google Apps Script project that sends an email when a button is clicked on a HTML sidepanel I've built. Currently the script works as planned and fires off an email when told, but I'm wondering if there's any way that it could check that the email sent correctly so I can notify the user that it's ok to close the tab?

Thanks in advance

Upvotes: 0

Views: 2655

Answers (2)

Morney Deetlefs
Morney Deetlefs

Reputation: 1

var emailsLeft = MailApp.getRemainingDailyQuota()

Upvotes: 0

Amit Agarwal
Amit Agarwal

Reputation: 11278

If you are using the Gmail API to sending email, it will return the ID of the email that you can use to trace the email in your mailbox.

Google Script stores a copy of every sent email in the Gmail sent items folder. If you are using the GmailApp service, search the sent items for a copy of the email. If found, it was sent.

GmailApp.search("in:sent to:[email protected] after:epoch_time")

You can use epoch time in Gmail search to find emails that were sent in the last minute or so.

Upvotes: 1

Related Questions