Is there a way to open a dialogbox when email send in apps script?

51 Views Asked by At

I am creating a G-Mail Add-In with apps script.

What I wanna do is when user send an e-mail a dialogbox will open and user will click to yes from dialogbox then mail will be sent.

Is there any event or any way to do it?

I did this with ItemSend and OnMessageSend event in Office JS in Outlook but I didn't find this kind of event in apps script. It doesn't have to be apps script If is there any other way I would use it

1

There are 1 best solutions below

10
Cooper On

How about something like this?

function sendEmail() {
  let r = SpreadsheetApp.getUi().prompt("Send Email?","Just click the appropriate button",SpreadsheetApp.getUi().ButtonSet.YES_NO);
  if(r.getSelectedButton() == SpreadsheetApp.getUi().Button.YES) {
    Logger.log("Send email");//Put emaiil sending code here
  } else {
    Logger.log("Don't Send")
  }
}