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?
AR: AR Embedded
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?
We use the following through a SiteManager on many of our machines:
smtpServer := ‘10.44.10.220’;
sender := 'firstname.lastname@example.org';
receiver := '<<recipient email address>>';
subject := 'test mail';
text := 'this is test email';
IF sendEmail THEN
SmtpSend_0.enable := TRUE;
SmtpSend_0.pHost := ADR(smtpServer);
SmtpSend_0.pUser := 0;//ADR(user);
SmtpSend_0.pPassword := 0;//ADR(password);
SmtpSend_0.pSender := ADR(sender);
SmtpSend_0.pReceiver := ADR(receiver);
SmtpSend_0.pSubject := ADR(subject);
SmtpSend_0.pText := ADR(text);
SmtpSend_0.port := 25;
IF SmtpSend_0.status < 60000 THEN
SmtpSend_0.enable := FALSE;
sendEmail := FALSE;
Hope this helps
We will test it. Many Thanks
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).
Project Sample Send Email Gmail & Guide.zip (878.1 KB)
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.
Hopefully you will find this information usefull!
thank you very much for the sample project. I’m currently testing it. I think it will work.
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.
Thanks & Regards,
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.
Thanks for your reply.
As I have turn off the firewall and I have used router with SIM card in which internet is working fine.
I am sharing you the screen shot for your reference.
As i have activated 2 step verification for my account but still the problem is same.
I hope you understand my above concern.
I would really appreciate your efforts to resolve my issue for sending the email from 4PPC70.0702-20B.
Thanks & Regards,
Hello again Shrenik,
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
Thanks Roger for support and guidelines.
I will try to resolve the issue and let you know.
Thanks & Regards,