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.

Sending email from CR800


Matevz Sep 12, 2013 08:33 AM

Hi all,

I am trying to send email from CR800 datalogger that is connected with serial port to GPRS modem/router. The LoggerNet is connecting to CR800 via IP port of router nad its serial port. Everything is working ok as far as sending and reciveing measurements data. Now i used the code (found on this forum) for sending email :

//CODE
Public batt_volt, Dest(12,6), AVW_Result
Public Bara, PTemp, Freq(17), Temp(17), Lin(17), k(17) ,Lu(17) ,B(17), Z(17), gl(17), mH2o(17),kPa(17)
' Send email variables
Public Send As Boolean
Public Temp_Threshold = 12
Public Outstat
Public EmailSent
Public TXEmailResult As String *50
Public LastFileName As String *50
Public TXMessage As String *200

' Send email parametres
Const TXServerAddr = "smtp.gmail.com:587" 'This is the address of the SMTP server you want to use to send the email
Const TXToAddr = "to@address.si" ' This is email address you want to send a message to.
Const TXFromAddr = "from@gmail.com" 'This is the email address that the recipient will see in the 'From'
Const TXSubject = "CR800 - Cinkarna Celje" 'This is the subject of the email you will be sending
Const TXAttach = "" 'This is the local name of any attachments you want to send
Const TXUserName = "************" 'This is the user name for the email account you will be sending the email from
Const TXPassword = "************" 'This is the password for the email account you will be senging the email from

.
.
.

BeginProg
If PTemp > Temp_Threshold Then Send = True
'Mail message text
TXMessage = "This is an automated alarm from station CinkarnaCelje. The current temperature of " & PTemp & "has exceeded the threshold." 'Form up the message body.
' Turn Modem on
SW12 (1)
' Set up coms for local AVW 200
SerialOpen (Com1,38400,4,0,50)
' Set up coms for Rf416
SerialOpen (Com2,38400,4,0,50)
Cal_figures

Scan (2, Min,0,0) ' Scan every hour
Battery (batt_volt)
'Barametric Pressure
VoltSe (Bara,1,mV2500,1,False,0,250,0.196,610)
PanelTemp (PTemp,250)
Local_Sensors
Outstation_1
Calculations
CallTable Rdgs ' store a set of readings

'send mail
If Send Then 'If the variable send is equal to true then do the following.
EmailSent = EmailSend (TXServerAddr,TXToAddr,TXFromAddr,TXSubject,TXMessage,LastFileName,TXUserName,TXPassword,TXEmailResult) ' This instruction tells the data logger to send an email using all the information from above.
Send = False 'After the email sends, set Send back to false to prevent sending multiple messages
EndIf


NextScan
EndProg

// END CODE

CrBasic compiles the program without any problems, but i dont get any email, even though the thresholds are reached.

I don't have a clue to how to check for errors?

Any ideas?

Thanks, m


aps Sep 12, 2013 09:25 AM

Is the CR800 running a PPP connection to the router or is the router setup to act as a serial server?

If the CR800 is not running a PPP connection then you cannot send emails using the built in instructions as they rely on being able to pass TCP/IP traffic (over the PPP link) from the logger out onto the internet.

That does not happen if the router is setup to run as a serial server only.

That may not mean you cannot send emails, as sometimes you can send special AT commands to some GPRS devices to get them to send an email. However, you will need to work out the series of instructions to do that.


Matevz Sep 12, 2013 05:35 PM

"Is the CR800 running a PPP connection to the router or is the router setup to act as a serial server?"

Not sure how to check this, but CR800 is connected to InHand 3G router with serial port. we connect from Loggernet through ip address 10.53.6.1:6785. On router this is set as virtual - serial port with TCP protocol...


aps Sep 16, 2013 08:08 AM

If you are using a virtual serial port this is almost certainly a transparent serial connection as far as the logger is concerned, i.e. not a true TCP/IP connection.

If you want to send emails the logger needs a TCP/IP connection. Please talk to your router supplier to see if it supports PPP connections or consider connection the logger to the router via an NL200 interface as I believe that router may have some ethernet ports too.

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