google-app-maker

Save Url of email sent by google app maker


I'm currently creating an application with Google App Maker. When I send an email inside the app with Gmail, I want to save the URL of the email to have quick access to the thread of the email. How can I do that?

I've already see this:

The function sendEmail inside google app maker doesn't return an url. I wanted to scrape a gmail page, but with google app maker it's useless.

I've read all the google app maker documentation, but have not found a solution.


Solution

  • Ok so like Markus Malessa explained me.

    You need to call GmailApp.createDraft().send().getId();

    this call will return the id of the email just been sent.

    What gonna happend here is The GmaillApp gonna create a Draft of your email and gonna send it and save the ID of the mail then you can combine a link with the id and when you gonna trying to access this link you gonna have a redirection to Gmail and gonna show the search mail (You have example below).

    You can find what parameter createDraft() wait here.

    All you need to do is this :

    var mailId = GmailApp.create().send().getId();
    var LinkMail = "https://mail.google.com/mail/u/0/?tab=rm#sent/" + mailId;
    

    Now you have access to the email just been sent and do what you want !