Our full technical support staff does not monitor this forum. If you need assistance from a member of our staff, please submit your question from the Ask a Question page.


Log in or register to post/reply in the forum.

Trouble with EmailRelay function on CR6 (w/ external router)


Caik O. de Miranda Jul 29, 2025 04:00 PM

Hi! I am facing a problem using the EmailRelay function.

I have a CR6 connected to an internet router, and both are powered by a set of 12v battery + solar pannel charger. The datalogger needs to be powered full time, as it is monitoring sensors in real time (1 minute scan). In this set, the EmailRelay function will send me a notification once one of the sensors detect a certain threshold value.
As the router consumes a lot of power from the battery, the idea is to turn it on only when the email is about to be sent. This was smoothly done with the coding in CRBasic Editor and it's everything working almost fine.

However, making a lot of tests, I realized that: [1] if the datalogger program is loaded with the router already on (not what I want, done just for testing), the emails are sent correctly; [2] if the router is turned on while the datalogger program is already running (the real situation I want), the emails are never sent - even waiting a lot of time for the router to properly start.
In the coding, I have lines to retry sending the email if the EmailRelay function does not work (answer different from -1), and in my tests I left the trigger always on - so the EmailRelay would be tried on every scan (which works for situation [1]); but anyway, the emails are not sent in the situation [2] described above. 

Do you have any clue on why this happens and how to solve it?

Thank you in advance!

Best regards,

Caik


JDavis Jul 30, 2025 08:45 PM

If the CR6 has a second IP interface such as wifi or cell modem, you need to have IPRoute in your program to specify which interface to use.

The router might be using a low power mode that is not working properly with the low power mode of the Ethernet port on the CR6. Default mode of the Ethernet port is to turn on once per minute to check for a connection. You could set it to always on in the CR6 settings to see if that is the issue. 

If the low power mode of the Ethernet port is the issue, set the port to Always On. Use the IPNetPower() instruction to control when the Ethernet interface is on to save power.


Humble_Sampler Aug 1, 2025 12:32 AM

I have a similar issue with the EmailRelay function. My CR1000x was connected to the RV50X modem via the Ethernet cable. There is no other IP connection to the CR1000X. I tried to use the IPRoute function JDavis suggested, but I am still getting "Cannot connect to EmailRelay service.".  I put the modem's IP address to IPRoute ("192.168.13.31",0,1).

Do I need to open a specific port on the modem's firewall to let the traffic go through? Please advise. Thanks!


JDavis Aug 1, 2025 05:10 PM

In the case of the RV50X connected to Ethernet of the CR1000X, IPRoute() is probably not needed. IPRoute() is only needed when the data logger has more than one IP interface. The most common situation is a cell modem connected to CSIO and a local network connected to Ethernet.

If a cell modem connection is otherwise working for data collection, but always fails for EmailRelay() most common issue is DNS. The DNS server that a cell company uses might not stay up to date often enough. You can force a cell modem to use a different DNS server like Google(8.8.8.8). If you didn't buy cellular service through Campbell Scientific, there might be security settings on the cell plan that do things like block certain port numbers. I usually only see that on custom cell plans some government agencies have set up.

Log in or register to post/reply in the forum.