How to use AppScript sleep(milliseconds) to set a delay in between sending emails of Martin Hawksey's mail merge

746 views
Skip to first unread message

David Rosenberger

unread,
May 5, 2023, 10:42:16 AM5/5/23
to Google Apps Script Community

Hi - I'm using Martin Hawksey's mail merge script to create helpdesk tickets. The script is too efficient and my ticketing system blocks the tickets (detected as an email loop).


I'd like to use the sleep(milliseconds) utility so that there is a delay between each line of the mail merge, but I don't know where this utility should go within the script or the syntax to make it recursively delay through each line of the spreadsheet.


:-)


Message has been deleted

David Rosenberger

unread,
May 10, 2023, 12:59:31 AM5/10/23
to google-apps-sc...@googlegroups.com
Using Utilities.sleep(...) just above the advanced parameters section was all it took!
( GmailApp.sendEmail(row[RECIPIENT_COL], msgObj.subject, msgObj.text, {
          htmlBody: msgObj.html,

On Tue, May 9, 2023 at 6:36 AM Web Dev <webd...@gmail.com> wrote:
I'm not familiar with the referenced script but most likely you won't be able to augment it (the original script) with your desired behavior unless you take a copy of the script and modify it. As far as your requirements, seems like you either need to write a recursive function to execute each line based on
1) `withSuccessHandler` callback + UrlFetchApp.fetch(), if making a network request to your external service google.script.run.withSuccessHandler(ready).postToMyTicketingSystem(ticket) -> UrlFetchApp.fetch();...
or
2) use Utilities.sleep(...)

webdev
--
You received this message because you are subscribed to a topic in the Google Groups "Google Apps Script Community" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-apps-script-community/_cruP7t-lN8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-apps-script-c...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/663089a7-0c63-451e-96ec-b992bd406865n%40googlegroups.com.


--

David Rosenberger

Helpdesk Analyst | Haymarket Media Group

M: (845) 243 - 3808



Remarkable content

www.haymarket.com | Twitter | LinkedIn


This e-mail and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the sender by replying to this e-mail.


Haymarket Media, Inc., 275 7th Ave., 10th Floor, New York, NY 10001

Reply all
Reply to author
Forward
0 new messages