
ThisBody := replace(thisBody, "", userFullName()) Let body := 'Email Template'.'Email Body' įor thisListPerson in select 'Contact Email Lists' where 'Opt In' = 1 and 'Email List' = thisList do Let subject := 'Email Template'.'Subject Line' "the body of the email uses the replace function to substitute data from the datbase for the"
#COMO TRABAJAR EN APP NINOX APP CODE#
"this code loops through each contact assigned to the connected email list and sends them an email" The magic happens behind the Send button on the Mailouts view: The latter two are filled in automatically when the process runs:Ĭlicking the button causes the code to run and send the emails - here's what the email in the sample template looks like: Again there are only two input fields here - links to Email Lists and Email Templates - but I have added fields for Date Time Sent and Sent By (which is the user). The final table is all about recording that a template is being to a list and also includes the button with the code to send the messages. The essential fields here are the two references - but I've added an Opt In field which allows you to indicate whether people are opted in to the emails or not (and the sending code will take this into account). This table is where you can assign a Contact to one or more Email Lists and creates a Many to Many relationship between Contacts and Email Lists. You can see that there are two links though - a Subtable called Mailouts and also a reference from Contact Email Lists. Keeping this simple, there is only one input field here - the 'List Name': The idea behind this table is to allow you to create multiple lists of contacts and that a Contact can be a 'member' of more than one of them. If you don't know HTML, then you could create your text in one of many online HTML editors like this. The interesting thing here is that the Email body is entered in HTML - which allows you to create good looking emails. This table is very simple - consisting of just 3 input fields, Template Name, Subject Line and Email Body:Īnd, once fully set up the page looks like this: We will also need a little NX Code attached to a button to actually send the messages. Mailouts - we create a new record in here each time we want to send a template based email to the a list (this is a Subtable of Email Lists) To achieve this, I am going to need 4 new tables:Įmail Templates - which is where the email Subject and Body are stored - the latter in HTML format.Įmail Lists - this is a record for each list we want to be able to send to.Ĭontact Email Lists - here we link Contacts and Email Lists - it builds a Many to Many relationship between them (this is a Subtable of Contacts) In the process I also want to record each time a message is sent to the group, recording the template used, the date sent and the user who sent it. I want to create a facility for users of my database to be able to create mailing lists, add Contacts to them, and then send emails to them based upon a template which will allow for insertion of contact specific data as the messages are sent. In this database, we start with two tables - Companies and Contacts - it is a very simple Contact Database. I am going to be basing this post on the database used in my previous post ' Relating to Relational Databases - Part 1' so you may want to check this out before we start. You can sign up for one here.Īlso, I have exported the database used in the article and it's available here - you just need to load it into your Ninox Cloud account. Here goes…īefore we start, to create this yourself, you'll need a Ninox Cloud account (sending emails only works in the cloud).
#COMO TRABAJAR EN APP NINOX APP HOW TO#
While sending basic emails is simple, the user wanted to know how to send emails to mailing lists periodically and to be able to change the content each time without changing the code.


I find myself writing this post partially in response to a question in the Ninox forum about sending emails to Contacts.
