Email unique content based on one or more topics of interest- gMail Pack


Hopefully someone an help with this. I am trying to send a specific email via the gMail pack to each person in the People table based on one or more of their interests. In other words If Person A is interested in Goats and Cats and Person B is just interested in Cats, then clicking the Send Email button on the Cats related row in the Newsletter table will send content to Persons A and B but sending an email related to Goats will only send to Person A.

I’ve been trying various variations of the code below in the button but I can’t get anything to work:

     Gmail::SendEmail([User's private Gmail account],[currentValue.Email Address],"Newsletter",[Content}),

I can’t view the doc, but are the interests their own table?

If not, I would recommend making them a table (so that in the People table, they select their interests from a dropdown that is a Relation to the interests table). Then in the interests table, you can have a column called “People interested in this”, and select Linked Relation → People (this will automatically grab all the people who have this interest).

Then the email formula will be much simpler, something like thisRow.interest.[people interested in this].[email address]

(And by the way, your sample code is slightly off pattern. Rather than doing ForEach...If, it’s usually better to do People.filter(

Thanks Nick_HE

I have three tables:

|__ Animal • each row with a unique animal: Goat, Cat, Dog, Bird

|__ Name
|__ Interests • multi select list from Topics
|__ Email Address

|__ Title
|__ Topic • single select from Topics
|__ Action • with a button to send the email
|__ Content • the body of the email

Ideally I would add a row to Newsletters, assign a topic and hit send to address just the people who have selected that topic in their list of interests.

I just realised that I hadn’t made the emended doc public and that’s why it couldn’t be seen. Rookie error!

Found this draft response that I never sent… (haven’t reviewed the doc yet though)

Ok perfect.

So just add another column to Topics, called “People Interested”. For column type you’re going to choose Linked RelationPeople (Interests)

So now for the button in newsletters, you can say

ForEach(thisRow.Topic.[People Interested],
    [User's private Gmail account],
    [currentValue.Email Address],

In general, I like to do intermediate calculations in columns where possible, rather than over-complicating formulas. If you wanted to take this philosophy a step further, you can prepare the message content in a Compose column, and then just reference that column in the formula above.

That’s awesome @Nick_HE … worked a treat.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.