All TRI-PLC with built-in Ethernet can send email via the SMTP server provided by the ISP which typically do not require authentication (since the ISP knows from the IP address whether the machine attempting to send email is one of its subscriber). However, if your ISP happens to insist on authentication before it will allow sending email via its SMTP server, then you may not be able to send email directly through this ISP.
Fortunately, the TLServer version 3.15 software that is included in your i-TRiLOGI software package does have the option of authenticated SMTP connection, and you can route your PLC's email via the TLServer using the <REMOTEFS> tag. The following are the step by step instructions:
1. Setup Authenticated Emailing with TLServer
* Start TLServer on the PC in which it will run 24/7.
* Goto "Setup Emails"
* Enter the SMTP server and port number of your outgoing mail server (default port is 25).
* Enter the username and password for your SMTP server authentication.
* Click on "Test" to test the settings. You will need to enter a destination Email address.
* Close the Setup Emails window to enter the settings.
* Contact your ISP if you don't know any of the above details. See the Setup Emails section of chapter 3 in the TL6 Programmers Reference Guide for more information.
2. Setup Port Forwarding for the Network that the PC running TLServer is on
If the TLServer is not on the same local area network as the PLC, then the TLServer must be made accessible to the Internet to receive TCP/IP request from remote PLCs in order to process email on behalf of the PLCs.
* The network that the PLC running TLServer is connected to must have port forwarding setup so that remote clients (PLCs) can connect to TLServer.
* You will need the IP address and port number shown on TLServer (the one you will be running 24/7)
* Follow the instructions from the "Accessing The PLC from Internet" Section of the F-series or Nano-10 user manual (chapter 2.8 or 2.7 respectively) to setup port forwarding.
* Contact your IT administrator if you are unsure.
3. Program a Remote PLC to Send an Email
You will need the following information in your program:
* Internet IP address. This is provided by your ISP for the network that TLServer is running on. This is not your PLCs IP address or TLServers IP address.
* Port number that TLServer is using. This is shown on TLServer. This is not the SMTP port number that you setup for Emails in TLServer.
* Email address of the recipient. The sender Email address is not important but must be valid.
Use the following code in a custom function. Once the function is executed, the Email will be sent (with your specific settings of course).
PRINT #4 "<RemoteFS 192.168.1.180:9080>" 'make a remote connection to your Internet IP address.
PRINT #4 "<EMAIL recipient@email.com>" ' replace with your destination email
PRINT #4 "SENDER: sender@email.com" ' should be a valid server address
PRINT #4 "SUBJECT: Email sent by your PLC"
PRINT #4 "I am a TRiLOGI PLC"
PRINT #4 "This is a Hello Message"
PRINT #4 "</>" ' end the email.
PRINT #4 "</RemoteFS>" ' end the remote connection
Note that the IP address used in the above code should be replaced with the Internet IP address and the port should be the one used by TLServer (default is 9080). If port forwarding is setup correctly, a PLC should be able to connect remotely over the Internet using the Internet IP address of the location where TLServer is running and the port number which will be forwarded to the local IP address of the TLServer (the IP address that TLServer shows)
Also note that the above code does not do any error checking so you won't know if it is successful unless you physically see the Email. You can improve the code by adding error/status checking. You can also look at the TestEthernet.PC6 program for more examples on sending Email and making remote TLServer connections.