This article will cover configuring a SMTP Profile using Gmail and configuring POP3 for acknowledging alarms. This article will focus on specifics for Gmail but the concepts discussed can be applied to other SMTP servers or POP3 implementations.
What is SMTP?
SMTP stands for Simple Mail Transfer Protocol, this is one of the most common protocols used for emails. The most distinct aspect of the protocol is that it's the only mail protocol dedicated to sending emails. Most email clients rely on SMTP servers to 'push' updates/send emails. SMTP utilizes 2-way synchronization, meaning that everything is synchronized to include 'read' mail, folders, sent mail, regardless of how you are accessing your inbox. The inbox is not downloaded locally but instead you are viewing it with your active connection to the SMTP server.
What is POP3?
POP3 stands for Post Office Protocol and is considered to be an older protocol which only utilizes one-way email synchronization. One of the defining features of POP is when an email client is connected, it downloads the contents of your inbox locally and in batches. Any items sent from your POP client or organization does not get synchronized. This means if you setup a new POP client, the only thing downloaded is the mail received from the inbox. When a new POP client requests from the inbox, sets of emails are downloaded in 'batches' from the POP server in order of oldest to newest. This order of operations applies to both a batches individual mail and the batches themselves.
Email Alarm Notification profiles:
There are two ways to configure your gateway to send emails and they both use SMTP as their transport protocol. The first is defining the SMTP settings directly on a "notification profile". To test this profile you can run Test Pipelines to see if you receive an email. Alternatively, you can create an SMTP profile by going to "Email Settings". The advantage here is that through scripting, you can reference the profile without redefining the configuration for your notification profiles. There is also an option to test if your emails are sent successfully from your gateway by clicking "More>test" on the profile.
Two-way acknowledgements with Ignition:
Within Ignition there are two methods to acknowledge an alarm through email. Both are defined on the notification profile.
1) Two-way Settings:
This adds a hyperlink to an alarm email's message body and requires your gateway to be publicly accessible. The provided hyperlink navigates users to a page hosted by the ignition web server to acknowledge the alarm.
2) Pop3 Two-way Settings:
These settings are entirely separate from "Two-way Settings". It allows Ignition to connect to and monitor an inbox using POP3. That means at the interval defined by "polling interval" we retrieve/download the messages and parse through each of them looking for "ackid" string to match with an existing alarm event.
GMAIL Example For POP3:
This example will cover using Gmail's SMTP for your outgoing mail and with Gmail's POP3 for acknowledgement.
Step 1-
Gmail as of May 30, 2022 has discontinued their settings for 'less secured' apps. In order for Ignition to connect to a Gmail inbox for use you need to go to your Gmail account settings>security and create an 'app-password' as a 'mail' type or 'other'. Click here for official Google documentation.
Step 2-
Setup a SMTP Profile in your Ignition Gateway by going to config>email settings>create new SMTP Profile. Based on Google's documentation, POP3 has different security standards then SMTP. To keep these settings separate we need to setup the Email Profile for outgoing mail.
- Specify Hostname as "smtp.gmail.com" which is based on Google's documentation.
- Port is 587.
- Enable STARTTLS.
- Username is the email address of the chosen Gmail account.
- Password is the 'app-password' you set on the chosen Gmail account.
Step 3-
Create the notification profile by going to config>Alarming>Notification>Create Notification Profile.
- Select 'Use SMTP Profile' and select the one you created in Step 2.
- Set Pop3 Two-way Enabled to true.
- Set SSL/TLS to true based on Google's POP documentation.
- It is important to note that SMTP settings requires STARTLS with SSL/TLS set to false while POP3 settings requires SSL to be enabled.
- Setting Delete on Acknowledge to true is optional. Enabling this setting will delete the email from the monitored inbox after we use it to acknowledge an alarm.
- Hostname is "pop.gmail.com" per the Gmail's email provider documentation.
- Port is 995 per Gmail's email provider docs.
- Username and Password is the monitored inbox's email address and app-password.
- Gmail documentation states that you can use the flag "recent:" to prioritize sending newer batches first rather then working from the oldest to newest by default.
- In large inboxes, some form of "recent:" may be required check with your POP provider for available flags.
- Gmail documentation states that you can use the flag "recent:" to prioritize sending newer batches first rather then working from the oldest to newest by default.
- Polling Interval can be left at default or changed at your discretion.
- Defines how often we are downloading from the monitored inbox to parse the emails.
- POP sends a single batch of emails per poll from oldest to newest batch.
Step 4-
POP is an older protocol and the TLS/SSL it uses is disabled by default in current Java releases. The Knowledge Base Article here covers how to enable the TLSV1 and TLSV1.1. Don't forget to restart the Ignition service after making these changes.
Step 5-
If everything is done correctly at the polling interval, the profile will start to go through the inbox oldest to newest. Depending on the size of the inbox, it may take some time before you see an alarm get acknowledged. When a new email is generated and received by the inbox, the message will be parsed to locate an 'ackid' and acknowledge the corresponding alarm. To see if the 'ackid' is being recognized, you can enable the logger, 'alarm.Notification.Email.Pop3AckManager'.
Troubleshooting:
Currently, there are only two loggers available to troubleshoot POP3 issues.
1) 'alarm.Notification.Email.Pop3AckManager' shows you if an 'ackid' is found and if there is a matching alarm to acknowledge. Not seeing any output by this logger is an indication of no 'ackid's being found in the inbox.
2) 'alarm.Notification.EmailNotificationProfile' contains output that can be a bit confusing.
- The Hostname is referring to the SMTP hostname/port configured on the notification profile
- The contents of the error is regarding POP3 and Ignition attempting to connect using the POP settings to download the emails.
- Read timed out is a general response that your settings could be wrong or a genuine time out.
- You can test a normal timeout using a 3rd party POP client such as 'Mozilla Thunderbird' to confirm the pop settings and network connectivity.
- If there are no issues connecting to the inbox, there will be no output.
Comments
0 comments
Article is closed for comments.