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.

amelioration of email send instruction


fdec Dec 7, 2015 02:32 PM

Dear All

actually i use a program for receive an email when an alert is active
please find below a part of my code :

'Main program variables

Public Batt, RefTemp, Temp
Public Result as String * 50
Public AlarmTrigger As Boolean
Public Message As String * 250
Public EmailSuccess As Boolean

Const ServerAddr="mail.gmx.com:587"
Const ToAddr="X@X.X"
Const FromAddr="X@X.X"
Const Subject="Email Message Test"

Const UserName="XX"

Const Password="XX"

Const CRLF = CHR(13)+CHR(10)

BeginProg

Scan (1,Sec,3,0)

Battery (Batt)

NextScan

SlowSequence

Scan(1,sec,1,0)

If AlarmTrigger = False Then

If Batt < 13 Then AlarmTrigger = True

If AlarmTrigger Then

Message = "AIE!!" + CRLF + CRLF

Message = Message + "This is a automatic email message from the datalogger station " + Status.StationName + ". "

Message = Message + "An alarm condition has been identified. "

Message = Message + "la batterie est " + Batt + " Volts." + CRLF + CRLF + CRLF

Message = Message + "Datalogger time is " + Status.Timestamp
EmailSuccess=EMailSend(ServerAddr,ToAddr,FromAddr,Subject,Message,Attach,UserName,Password,Result)

EndIf

EndIf

If Batt > 13.1 Then AlarmTrigger=False

NextScan

EndProg

Actually i receive an email when the battery fall under 13V but it's all
i want to receive an email each 10 min or each hour (when the modem is open ) does it's possible?
regards


JDavis Dec 8, 2015 11:14 PM

You would just need to add a time based trigger within your main scan. Never use TimeIntoInterval within a SlowSequence; it wouldn't trigger.

Here is an example:

If TimeIntoInterval(0,60,Min) Then AlarmTrigger = True


fdec Mar 22, 2016 07:11 AM

Dear Jdavis and other

thanks for your answer.

your instruction work perfectly and my program too

But one thing i have a problem. The GPRS modem are off line on the night and if an alert appears on the night, i will not receive them when the modem turn on line on the morning (the modem is wiring on the sw-12 channel.

Does it possible to receive the alert appears on the night when the modem turn on line on the morning.

while waiting to read you regards


JDavis Mar 22, 2016 02:45 PM

You would need to add some additional logic to force your modem on when you have an alarm condition.


fdec Apr 19, 2016 06:50 AM

Dear Jdavis, i try to add a condition but i don't receive mail when it's the night.

i think the delay is too long between the allocation of the IP address and outbreak alert

How long is stored the mail in the memory if the datalogger can't connect for sending the mail?

if this is the case, does it possible to receive when the station is online to receive an email alert if a value in the datatable is stored?

while waiting to read you

regards


Dana Apr 19, 2016 07:52 PM

The EmailSend instruction, by default, times out in 75 seconds.

Put in another conditional statement to not reset AlarmTrigger to False (turn the alarm off) until EmailSuccess is True. 

Dana W. 

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