Custom SMTP module adds the ability to send e-mail messages in the application.
Installation and configuration
To install this module in the project, go to Modules section and find Custom SMTP.
After installation the following fields are required to be set up:
- Login (required) - email address to be used for sending e-mails.
- Password (required) - password from the selected email address.
- Server address (required) - address server which is used for sending e-mails. By default: smtp.gmail.com (Gmail).
- Server port (required) - port number of the selected server address. By default: 587 (Gmail).
- Use TLS (not required) - transport layer security protocol. Is turned off by default.
- From Name (not required) - sender’s name to be used by default.
The following BP is generated by default for backend usage:
- Custom SMTP: Send email - send email according to the given fields:
- Subject [string] - email subject;
- Body [text] - email body;
- To [email array] - array of receiver’s emails;
- Сс [email array] - array of emails in copy;
- From_name [string] - sender’s name;
- Bcc [email array] - array of blind copy receivers;
Usage example
Here is a simple example of sending basic email with the given text to the selected email when the button is pressed.
We are going to use default Gmail settings in this example. First of all it is required to prepare Gmail account for sending out emails via third-party applications:
- Open Gmail account settings;
- Go to Forwarding and POP/IMAP tab;
- Toggle on IMAP Access;
- Save the changes;
Then install Custom SMTP module into your project and configure it accordingly.
Once the module is configured create an Endpoint for Custom SMTP: Send email business process:
- Create new Endpoint group;
- Create new endpoint instance in the newly created group;
- Set it up as on the picture below;
After that, you can start creating the frontend of the application. In this example the design looks like on the picture below.
Email is being sent once the button is clicked (onClick) and the corresponding business process looks like:
- InputEmail Get Properties - get the receiver’s email address from Input Email component;
- To Array - converts email address into array of addresses since the Server request POST /sendemail/ gets arrays in the input only;
- InputText Get Properties - gets email text from the Input Text component;
- Server request POST /sendemail/ - gets the values from Input components and executes Custom SMTP: Send email business process in the backend.