Author Topic: Sending e-mail issue?  (Read 18399 times)

jonathan.kaye

  • Newbie
  • Posts: 16
  • I'm a llama!
    • View Profile
Sending e-mail issue?
« on: February 12, 2015, 06:15:49 PM »
I’m trying to the TLServer to send a test email. I was able to do this no problem 4 months ago now I can’t seem to do it.

If I try to use a gmail account (turn on POP & try different ports 25, 587,465) I get...
“AuthenticationFailedException” or “Could not connect to SMTP host” or TLServer freezes up.

I tried with smtp2go and got…
“Certificate signature validation failed”

Not sure what I did right a few months back; anyone have any advice.

Thanks,

-Jonathan

support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3174
    • View Profile
    • Internet Programmable PLCs
Re:Sending e-mail issue?
« Reply #1 on: February 13, 2015, 09:52:41 AM »
You should use smtp.gmail.com as the SMTP and port 587 with your gmail email and account password for authentication.

However, we have recently tested this again (using the Email Test button in the TLServer email config window) and found that authentication fails because gmail has upgraded its security again and communication from TLServer is considered insecure for their current standards (although TLServer does use basic encryption and authentication).

In order for TLServer to access your gmail account and send emails, you need to go to your gmail account settings. In the "Sign In" Category, go to the last item called "Less Secure Apps" and turn it on.

This will lower your security settings for that gmail account, so you may wish to create a new account with a different password that you can use for email alerts.
Email: support@triplc.com
Tel: 1-877-TRI-PLCS

jonathan.kaye

  • Newbie
  • Posts: 16
  • I'm a llama!
    • View Profile
Re:Sending e-mail issue?
« Reply #2 on: February 13, 2015, 04:20:57 PM »
Yea that got it!

Thanks.

jonathan.kaye

  • Newbie
  • Posts: 16
  • I'm a llama!
    • View Profile
Re:Sending e-mail issue?
« Reply #3 on: February 16, 2015, 01:26:27 PM »
I still can’t seem to shake a “Comm Error!!”

In the PLC program & Setup
-Put the Email.pc6 program on PLC. (Changes sender, recipient)
-Changed PLC IP and gateway IP to get along with my home LAN
-Changed the PLC “Ethernet Configuration” so the SMTP IP & port is my PC running with TLServer

On my PC
-Open a port on firewall (Windows firewall -> Advanced settings -> Inbound Rules -> New Rule -> Allow TCP on range of local ports (same as above).
-Ensure Port# is the same as above in TLServer->Email Config

Hardware
-Good LAN communication because I can monitor the PLC/ download program to it.  
-I set my router to have fixed DHCP for the PLC and PC running TLServer.

What am I missing. I think my problem might be the windows firewall port as there is a bunch of settings along with ports. Any tips?

support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3174
    • View Profile
    • Internet Programmable PLCs
Re:Sending e-mail issue?
« Reply #4 on: February 18, 2015, 08:13:42 AM »
That Email.PC6 sample program is using a legacy method of sending emails when TLServer is connected to the PLC by serial port. It sounds like you are using the newer email relay method of sending emails.

Your PLC configuration sounds right as long as the SMTP port number is the same port set in the "Port # to Relay PLC Email" field in TLServers email setup.

Your PLC program just needs to run a function with the following code (replacing the sender/receiver emails with yours). You can also refer to the TestEthernet.PC6 sample program in the C:\TRiLOGI\TL6\usr\samples\Ethernet folder.

PRINT #4 "<EMAIL testaccount@gmail.com>" ' replace with your destination email
PRINT #4 "SENDER: testaccount@yahoo.com"   ' should be a valid server address
PRINT #4 "SUBJECT: Email sent by your PLC"
PRINT #4 "I am a TRiLOGI PLC"        'body line 1
PRINT #4 "This is a Hello Message"   'body line 2
PRINT #4 "</>"      ' end the email.
Email: support@triplc.com
Tel: 1-877-TRI-PLCS

jonathan.kaye

  • Newbie
  • Posts: 16
  • I'm a llama!
    • View Profile
Re:Sending e-mail issue?
« Reply #5 on: February 19, 2015, 04:30:16 PM »
Can't seem to get it to work.

I always have a comm error. Last I was playing it TLServer just started shutting down. Not sure what happened, on two separate computers, when I try to open the TLServer program it immediately shuts down (not open somewhere else, restarted computer).

Similar luck with smtp2go and the sample program.
 

jonathan.kaye

  • Newbie
  • Posts: 16
  • I'm a llama!
    • View Profile
Re:Sending e-mail issue?
« Reply #6 on: February 20, 2015, 03:22:52 PM »
So trying to use the BASIC e-mail auth. program to TELNET into a smtp server now.

I can log in to an smtp account though cmd with telnet command, but the plc wouldn't. Looking at the code, it is doing all the same stuff an arduino would do to send a e-mail (lots of info online for that).

I think my router might have something to do with it now. Even though I set aside a IP for it I don't think it is getting internet access. It never shows up on the client list (printers, beagle bones, wii, ect no problem). So I downloaded "NIST_TimeServer GDK&PP". That code looks to have connection check with NIST time server. I get "no response from NIST server"

Am I correct in thinking that I would get "no response" if it wasn't able to gain internet access?

support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3174
    • View Profile
    • Internet Programmable PLCs
Re:Sending e-mail issue?
« Reply #7 on: February 20, 2015, 03:56:06 PM »
Can you check the gateway settings inside the PLC. The gateway must be set to the same private IP address of the router (e.g. 192.168.1.1 or 192.168.0.254 etc). The PLC must be on the same subnet as the router so that the PLC can access the Internet through the gateway (the router).
Email: support@triplc.com
Tel: 1-877-TRI-PLCS

jonathan.kaye

  • Newbie
  • Posts: 16
  • I'm a llama!
    • View Profile
Re:Sending e-mail issue?
« Reply #8 on: February 20, 2015, 04:16:35 PM »
Gateway is set correctly. Checked through cmd ipconfig and though the router setup.

192.168.0.1 & 255.255.255.0

Any other routers work? Think my dlink might be junk.

support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3174
    • View Profile
    • Internet Programmable PLCs
Re:Sending e-mail issue?
« Reply #9 on: February 20, 2015, 04:56:54 PM »
What is your PLC's IP address?

A number of DLink or Cisco (Linksys) routers we tested do work. What is your DLink router's model?

I assume your PC is also connected to the same router to get access to the Internet? If so then your router does allow connection to the Internet.

You mentioned in your first post on this thread that you are trying to send email through TLServer. In the third post you said "Got it" - do you mean you manage to use the "Email Test" function  via TLServer to send out a test email?

If so then you should be very close to getting the email function to work.  Now what's left is whether the firewall(s) on your PC that runs the TLServer allows the PLC to make a connection to it.  

You may have already added the exception to Window Firewall, but do you know if you have other firewall running?  There was a customer who installed a trial version of Avast anti-virus software and the Avast software ran a firewall that block incoming connections. Yet because he has only a trial version he could not access the Avast settings to disable the firewall and that caused the kind of problems similar to what you encoutered. In the end the customer completely removed the Avast software and everything works as expected.


Email: support@triplc.com
Tel: 1-877-TRI-PLCS

jonathan.kaye

  • Newbie
  • Posts: 16
  • I'm a llama!
    • View Profile
Re:Sending e-mail issue?
« Reply #10 on: February 20, 2015, 05:30:46 PM »
-PLC IP address is 192.168.0.55 (MAC address, "f-server" name, and IP on DHCP reservation list). It wouldn't let me put it out of the designated range of IP numbers (think I read that somewhere).  

-DLink DIR601

-Modem to Router, Router to PLC and computers Cat5 and wireless (computers have internet access)

-The goal is to send event driven e-mail. Tried the TL server first, and best I could do was send an email test. Was never able to make a connection between the PLC and TLServer (always comm error). Wondering if the PLC is supposed to be directly connected to computer or router for this. Soon to re-install it as something is blocking it from opening on two different computers. When I open the program it pops up, then quickly closes. I use AVG and can "disable" it so will try the relay server after I re install TLServer.

I switched to using the TELNET method after TLServer started having issues.

***UPDATE***

Uninstalled AVG and turned off windows firewall. TLServer still wont open. Also re-installed Trilogy/TLServer still no go.


« Last Edit: February 20, 2015, 06:29:52 PM by jonathan.kaye »

support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3174
    • View Profile
    • Internet Programmable PLCs
Re:Sending e-mail issue?
« Reply #11 on: February 20, 2015, 06:40:51 PM »
Something in your network setup is affecting your connection. It shouldn't be so hard.

Yes, the PLC can be connected to the router and with the PC connected to the same router the PLC can send email through the TLServer acting as the relay server. In fact that should be the "natural" setup that it supposed to be. Direct connection between the PLC and the PC Ethernet port will not allow the PLC to access the Internet unless the PC Ethernet port has been setup as a bridge to the Wi-Fi.

And when the PLC is connected to the router via Ethernet cable, it should be able to access NIST timer server using the <TCPCONNECT> tag and also to access an external SMTP server to send email. In fact it is also capable of contacting a webserver to upload data or send a data file it created locally to a FTP server using the FTP protocol.

When you get the TLServer up and running, you should run the Wireshark network sniffer software and monitor traffic coming into the PLC's network port. For simplicity only use one active network interface (either Ethernet or Wi-Fi and not both) for wireshark monitoring. You can set a filter to display only traffic involving the PLC IP address. If there is incoming TCP/IP traffic to the TLServer you should be able to observe it on Wireshark recording.

Also if you have another router you can try it first just bypass some setup issues that we can't figure out for now.
« Last Edit: February 20, 2015, 09:14:01 PM by support »
Email: support@triplc.com
Tel: 1-877-TRI-PLCS

jonathan.kaye

  • Newbie
  • Posts: 16
  • I'm a llama!
    • View Profile
Re:Sending e-mail issue?
« Reply #12 on: February 22, 2015, 11:29:21 AM »
Picked up a new router (linksys). The PLC showed up as a "network device" added it to "DHCP reservation list".

So popped in the NIST program and it updated!

Changed over to the telnet/smtp program... boom it worked!

Haven't figured out why the TLServer wont open, but to be honest would rather have the PLC do all work.

I may do a little write up on this but some of the things I learned about SMTP/TELNET programs...

-If you make a SMTP2GO account. Make sure the "SMTP Username" doesn't have any spaces (think that was giving me an problem)
-Ensure you can see the PLC on your router network user list before you begin, add it to a static IP list.
-Test to make sure the PLC has internet access with the NIST sample program.

I was unsuccessful trying to rout email though a gmail account, only SMTP2GO. When you use "nslookup" in cmd the IP changes all the time for smtp.gmail.com. SMTP2GO's IP always stayed the same (from what I can tell it hasn't changed in months?). The sample program looks like it has to work with a static SMTP server IP. I'm sure better programmers can figure out how to ask the DNS for a IP from a domain, then pop it into the program before sending (or converted on the way out???).  

For now I'm pretty pumped... lots of playing around with some event emails!

I tried wire shark. Cool- but currently over my head. Thanks for the help!

support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3174
    • View Profile
    • Internet Programmable PLCs
Re:Sending e-mail issue?
« Reply #13 on: February 22, 2015, 06:53:40 PM »
Thank you for letting us know. We are glad that a new router has resolved the issue. Also thank you for your suggestion with SMTP2GO which we will recommend to other users.

The reason your TLServer could not start is most likely because of the serial driver in your Java is no longer reachable by TLServer which causes the program to crash when it is started. It is likely due to a recent Java update that overrode some of the class path settings. i-TRiLOGI will still work because i-TRiLOGI software does not interact with the serial driver and is therefore not affected by the change.

You can try to re-install the i-TRiLOGI software (latest version is 6.49 and TLServer 3.18B). During installation a copy of JRE 1.4.2_19 will be installed on your PC and you should start the TLServer by opening it from the Start Menu -> i-TRiLOGI -> TLServer 3.1. This will invoke the newly installed JRE 1.4.2_19 (32-bit) to run the TLServer.
Email: support@triplc.com
Tel: 1-877-TRI-PLCS