What options are there to send e-mails from a PLC? Are there solutions where the SMTP server is located directly on the PLC? Are third-party devices required?
Requirements:
CPU: 5PPC2100_BY34_002
AR: AR Embedded
AS: 4.2
The email recipient should be able to be adjusted if necessary.
Internet access to the PLC control would be possible.
I took a look at the “AsSmtp”. I’m not sure if it still makes sense to use this lib. Is there a smarter way?
Similar to what Jon shared, we investigated some years ago how to send emails from a B&R PLC using a Gmail account.
The sample project has also a guide that explains the required configuration that should be considered if this type of functionality wants to be used (at least when using a gmail account as the email server).
If that solution fits you, be also aware that around 2022 Google changed its security policies regarding signing in to a Gmail account using an app password (in our case that would be the PLC).
That information is not included in the guide and you will probably have to turn on the 2 step verification in that account using the steps from here.
As I have downloaded your sample project and configured the parameters as per the guide but still I am not able to send the mail from my display 4PPC70.
I am getting the error of Server is not connected.
I would really appreciate your support for solving this error.
I guess you mean the status “Connection with server failed”. In that case, in the section 5.1 from the guide you can find some of the most common reasons why that could happen.
I would first double check that all the required Google account security configurations are made in a way that allow the PLC to send emails. Remember to also turn on the 2 step verification as I mentioned in my previous post.
It also happened to me while I was trying to test this functionality that the network firewall was blocking the smtp communication. Just to make sure that it is not the case, I recommend you to try again using a non corporate network.
You can also test this project in simulation. Just connect your PC to different networks and check if the result is different.
I assume that you are still missing some configuration on your google account. Did you created an app password for giving access to your account from the PLC? (It is mentioned in the provided link from my initial post).
Once it is created, if you use this password in your program it will work. I have tried myself and I can assure you that it works.
If after checking that, you are still having troubles to get it to work it is for sure IT related and I am afraid that I won’t have any more suggestions for you.
Of course, you could always reach your local support contact in case of need so they can take a look with you.
I am positive that you will get it working soon enough
I am confused as to how this sample project was able to work? When attempting to use “smtp.gmail.com” as my pHost address, the SmtpsSend function returns error 32700 stmpERR_PARAMETER “One of the parameters pHost, pReceiver or pSender is NULL, or the IP address (pHost) specified for the server is invalid.”
According to the help docs, the supported IP address formats are numeric quartets (###.###.###.###). So I am curious as to how the project worked with “smtp.gmail.com”? I am aiming to use the same gmail smtp server, but not sure what pHost IP address to use.