Sending Emails
Last updated
Last updated
Many apps require communication with users via email. For example, sending email confirmation for a scheduled phone call or order confirmation.
A From address is required to send emails. Airkit allows for the configuration of different addresses to send emails from. To configure an email, go to Console. Under the Resources section, select New.
There are two options that deal with email. Select Email Address and type in a valid email address. Click create. This will allow this email address to be used to send emails. Once create is clicked, Airkit will trigger an authorization email from AWS. Check the email address and click the link to verify the email address. This will enable this email address for sending. Refresh the console page and select the email address. Notice that the Verification Status is set to "Success."
It is ALWAYS a good idea to setup a domain level verification to ensure smooth delivery so that emails are not caught in anti-spam filtering tools. In order to do this, a few DNS records will be needed to be added to the domain used in the email address that is in the desired from email address. Although the act of adding these records typically only takes a few minutes, it is a privileged request in many organizations and may require some lead time (please verify domains early).
To verify a domain, in Console:
Console > Resources > select New
Under Capabilities, select the "Email Domain".
Enter the domain in the provided box > Click create
Select the new domain from the list. Click the "Open verification instructions" button
In order to set up verification of the domain, a TXT record will be required. To enable DKIM for email verification, additional CNAME records will be required. Once the DNS has been updated, the domain verification will be automatically verified within Airkit, although this process might work within minutes, it could take up to 72 hours depending on DNS settings.
Go to your App, go to Configuration Builder, and scroll down to the Emails section. Select the New button.
Options will be available based on settings configured in the Console above. Adding a singular email address will present a dropdown of configured, available email addresses. Choosing Email Domain Address will present a box for an address and a dropdown for qualified domains. Make sure that at least one email is created, as it will be required to send an email.
Go to Connection Builder and create a new data flow, label it "Email - Send Thanks." In the From dropdown, select the email address. Type a valid email in the To field. In order to verify that the send works, this email address will have to be checked. In the Subject, field add the text "Thank you for your interest in our properties." For the text body:
Hit the play button at the top right of the data operation. The response in the run results should return "true." Checking addressed email should result in a new message with the specified content.
Once a verified email address & domain have been setup we recommend using an external email testing tool such as https://www.mail-tester.com to confirm the ability to send/receive email on behalf of the verified email/domain and also get a report on the DMARC (anti-spam) configurations of the account. Setting up DMARC properly will ensure more delivered emails.
Beyond sending generic emails, it is possible to customize the addresses, subject, body and even provide an HTML body of an email.
Add an input to the "Email - Send Thanks" Data Flow of type List of Text and name it emails. Add a second input of List of Houses (if there is no House Object, do list of Any) and name it houses. Set the emails to a list of valid emails of the format:
Set the houses to object to an array of houses:
The To field on Send Email action will work with either a text value of comma-separated email addresses or a list of email address text strings. Put the value emails in the Tofield of the Send Email action.
The houses are an AirData App Object. Let's configure our message to contain information about the houses sent in. Create another Data Operation above the email. Select type Transform from the dropdown. Enter the following Airscript into the Transform Expression:
This will take the title and asking price from each house output them in a text string. For more information, check out Working with Text in Airscript. Update the body text of the Send Email action to:
Hitting play on this action will now send an email with properties listed.
In addition to sending plain text email, it is also possible to send HTML email. It is possible to send an email with both a plain text and HTML version. Your email client will render the option that is most appropriate for rendering. Set the Body HTML of the send email action to:
Sending the email now should return a stylized email.
This is just one example of how to use email in Airkit. Other examples include sending event registration, sending completed documents, or other confirmation emails.
The Send Email Data Operation - for more of the details on how the Send Email Data Operation works.
Working with Files & Media - for information on assets that can be sent as email attachments.