Send emails
You can send emails from your Grexx Platform application using the Send email system service. For example, you may configure an activity to send an email automatically when a new customer creates an account or when a task is overdue. In addition:
- The Invite user system service uses the Send email system service to send the email invitation to the invitee.
- The Grexx Platform identity provider, XXID, can send multi-factor authentication and password reset email notifications to users.
By default, these emails are sent from [email protected]. Before making your application available to users in your Production environment, you may want to configure Grexx Platform to send emails from an email address on your own domain, such as [email protected].
If you want to send emails from a custom email address, you can:
- Allow Grexx Platform to send email on your behalf (by updating the DNS record for your domain).
- Send emails from your own SMTP server.
- Send emails from using your SendGrid account.
To use the first option with the Send email and/or Invite user system services, you only need to update the DNS record for your domain and specify the From address when creating a new system service case. To send XXID emails from your domain, you must also create an outgoing mail profile and configure XXID to use it, as described below.
To send emails from an SMTP server or from SendGrid you must create an outgoing mail profile and then configure the system service and/or XXID to use that profile, as described below.
Create outgoing mail profiles
Outgoing mail profiles allow you to configure settings for sending emails from your application, and then apply those settings to particular activities. Each outgoing mail profile is a case in a given environment (Development, Testing, Acceptance, or Production).
To create outgoing mail profiles, first download the Mail Profile component from Grexx Marketplace to your Studio, and then import it.
Next, create a casetype activity so that you can add new Mail Profile cases to your application. You may want to map the case ID of each mail profile to an attribute on a page casetype (such as a "Configuration" or "Utilities" page) so that you can use these values in mappings (and other inline templates).
You can then perform the activity in the relevant DTAP environment. You will need to specify the Profile type and provide SMTP settings or a SendGrid API key accordingly. To send emails from Grexx Platform using your own domain, select Built-in and ensure that you have also updated your domain's DNS record.
Apply an outgoing mail profile
To use an outgoing mail profile when creating a Send email or Invite user system service case, enter the case ID of the relevant Mail profile case in the Mail out profile field. You can also use a mapping to populate this field automatically: use the page. template function to access the relevant attribute on the page casetype.
To use an outgoing mail profile to send email notifications from XXID:
- From your Studio, navigate to Platform > Platform context.
- Add a new Context rule. To apply the outgoing mail profile to all XXID emails, add the rule at the top level. To apply different mail profiles based on a condition (such as the application hostname for multi-tenant applications), nest the rule within an
If thenblock. - From the Context type, select Platform mail profile.
- In the Value field, use the
page.template function to access the attribute in which you have stored the case ID of the relevant mail profile.
For more information about the platform context, see Context.