Sending email messages from the PLC sounds like an easy task. However, very few applications do this on the production floor. This is probably due to the networks involved, and authentication can be complicated. In our example, we will use a restricted Gmail SMTP server so that no authentication will be required. We will walk through sending email and text messages from the PLC to Google Gmail. Once in your Gmail account, the message can be automatically forwarded to another verified email or SMS text message address.
Google is removing “Less Secured Apps” in the mail app. (Gmail). This will allow you to generate an “App Password” for your controller or program. If you are using this to send Emails from your controller, you must enable 2-step verification.
Gmail Less Secure App Access – App “passwords
SMP” – Google – PLC Send Email Text Messages
Simple Mail Transfer Protocol (SMTP) is an internet standard for email transmissions.
Google provides three different SMTP settings to send email messages from a printer, scanner, or application (PLC).
- The SMTP relay service sends mail from your organization by authenticating with the IP address(s). You can send messages to anyone inside or outside of your domain.
- Gmail SMTP server – requires authentication with your Gmail/Google Apps account and password. Messages can be sent to anyone inside or outside of your domain.
- Restricted Gmail SMTP server – does not require authentication, and you will only be restricted to sending messages to Gmail or Google Apps users.
Restricted Gmail SMTP Server – PLC Send Email Text Messages
We will use a restricted Gmail SMTP server to send emails and text messages. This is located at aspmx.l.google.com. This does not require authentication, so more PLCs can communicate with the server.
You must set up this free service if you do not have a Google Gmail account. Google Email Account
Now start the Do-more Designer software. This is available free of charge and is a fully functional package complete with a simulator. We will be using the simulator for our example. The actual Do-More PLC must have an Ethernet connection connected to the internet. (H2-DM1E)
System Configuration – PLC Send Email Text Messages
Start a new project with the simulator or an existing one with a connection to the internet.
Select ‘SMTP Client (Email)’ and hit ‘OK.’
Beside the URL: enter the server address aspmx.l.gAddress’m and’ hit ‘Lookup’’ This will retrieve one of the server’s IP addresses. Then press ‘Select’ to return this address to the configuration page.
Ensure that the SMTP Server Port is set for 25. This is the default port setting. The Timeout setting can be left at 30 seconds. This is the time the PLC waits before setting any error message. Enter your ”‘From’ Email Address” – Enter your Google Gmail account address. Select ‘OK’ to ” ‘the configuration. “Ensure that authentication is disabled.
Ladder Logic Program – PLC Send Email Text Messages
We use the EMAIL instruction in the PLC to send the messages. We will send two messages; one will be an email and the other an SMS text message. The subject line will be different to distinguish the two.
Testing the Program – PLC Send Email Text Messages
We need now to set up Email forwarding to any account.
This will bring up a dialogue to forward Emails to a specific account. During this process, a verification code will be sent to this address. You must enter this code for validation or respond to the Email for the forwarding address to work.
Email to SMS Gateways can be used to forward your message in a text format. Here is a website showing a List of Emails to SMS Gateways.
Here are some that we use in Canada: Example: 613-451-0104 on Rogers network = firstname.lastname@example.org
Once the forwarding address is verified, we can move on to the last step, creating a filter. The filters will automatically look at the incoming Email message and act on the news. In our case, we will be forwarding the message.
Select ‘Continue >>.’
- Mark as read
- Please forward it to (Select forwarding address)
- Never send it to Spam
You can create as many filters as you wish. Sending to multiple accounts requires only repeating the filter with the additional email addresses.
In the above example, we used a restricted Gmail SMTP server. No authentication was required to send an email with only an internet connection to the PLC.
Watch on YouTube: Here’s a quick way to send email text messages from the PLC
If you have any questions or need further information, please get in touch with me.
If you’re like most of my readers, you’re committed to learning about technology. Numyou systems used in PLCs are you’reallenging to learn and understand. We will walk through the numbering systems used in PLCs. This includes Bits, Decimals, Hexadecimal, ASCII, and Floating Points.
To get this free article, subscribe to my free email newsletter.
Use the information to inform other people how numbering systems work. Sign up now.
The ‘Robust Data Logging for Free’ eBook is also available as a free download. The lin’ is included when you suFree’be to ACC Automation.