Configure Gmail as your Email provider in GpsGate
This guide shows how to setup GpsGate Server using a Gmail account as an SMTP server. We go through all the necessary steps, with an example, of how to send an email notification to a user from an alert generated by an Event Rule.
- Configure Gmail security settings
- Configure your SMTP server
- Setup your user
- Example: configure an Event Rule with an Email notification
Configure Gmail security settings
Gmail has introduced several new security features. There are mainly three things to take into account before using Gmail with GpsGate:
- Enable IMAP and POP for Google Apps
- Allowing less secure apps feature: another feature from Google to block sign-in attempts from some apps or devices. This feature must be turned on in order to be able your Gmail account to work with GpsGate.
- 2-Step Verification: enables to protect your Gmail account with both your password and your phone. This option is compatible with GpsGate.
Security settings scenarios
You have two options in order to use Gmail with GpsGate Server:
a. Configure your 2-Step Verification using this wizard.
(If you already have the 2-Step Verification feature enabled, you need to add a new App password in your account settings > Sign-in & security > App passwords.)
b. If you don’t want to use the option a then you need to turn on the Less secure apps feature. You can do it here.
(If you do not enable this feature, when trying to send a test from GpsGate Server your email submission will be blocked and hence you’ll get an error).
Configure your SMTP server
To configure your Gmail SMTP server in Site Admin, you have to go to Settings -> Email and select the following options:
The basic configuration for a Gmail should be as follows:
- Sender E-mail Address: the email address FROM where your email is being sent. When the recipient of the notification receives the email, this email will have the Sender Name registered in this address.
- SMTP Server Hostname: the SMTP address of your email provider.
- SMTP Server Port: Gmail uses 587.
- SMTP Username: the username of your account (without the @gmail.com).
- SMTP Server Password: your account password.
- Note: If you configured your account with the 2-Step Verification feature, you have to paste here the code given by Google. (check the first step in this guide).
- Use SSL: enable your SSL setting for Gmail.
Additionally you have Email Limitations options. Configure this screen if you consider the recipient should receive a maximum of notifications per hour. The quantity of outgoing emails will depend on how you configure your Event Rules. We will explain this further on.
You may want to use the Test option to verify your settings work properly.
Setup your user
To be able to send a notification from GpsGate, you have to select a user or a group of users that will receive the notification. To do that you have to assign this user/s to a tag. Tagging is a best practice recommendation and a good way to make it the administration of your application much easier.
- Create a new user with the role Operator.
- Assign this Operator an email address.
- If you don’t have a tag for this user, create it first (you can create a tag in Admin-> Tags or in the same Add new User interface).
- And assign only the operators that have email in their accounts to this tag.
Example: configure an Event Rule with an Email notification
Now is time to create the rule that will trigger the email notification to the operator or a group of users you have selected in the previous steps. To do that go to Admin -> Event Rules
In the step “2.Who this rule applies to” you may want to set a filter for the specific group of vehicles to which rule will apply.
If no options are selected, the rule will apply to all vehicles and tags available in the application.
In our example we only want this email alert to be executed for the vehicles in Sweden.
What will be your condition that will trigger the event? In the example case, we selected a Geofence Expression. To use geofencing in alerts, you have to create a Geofence Tag first. In our example we are using a geofence named “Stockholm geofences tag” that contains all geofences located in the city of Stockholm.
The next step in our Event Rule creation is to define the notification Recipients and email template.
For the Recipients part we will select the tag created previously that groups all the users with email addresses.
The second part consists in defining the Subject of the email. You can do that by mixing fixed values and variables available.
In similar way you will define the message content of your email. You can use the HTML option if you are going to include links and any other HTML feature in the body of your email.
Note the “Notify Start” option selected. This will generate only 1 email when the condition in the 4. Expressions is matched. If you select Notify start and end it will generate an email every time the vehicle goes out of the geofence, but also when the vehicle returns to the geofence (whe the condition End becomes true).
For the step “6. Presentation” unselect any screen output, click on Next and finally on Save.
As we have defined in our example, when a vehicle gets out of the defined geofence, an email address will be submitted to the recipients defined in the tag “Operators with Email” and this will apply only to the Swedish vehicles.
Event that generated the alert and the Email notification below: