Hello,
I am using a CR1000 (OS24) with a NL115 connected to a network.
The CR1000 has a fix IP address.
I am trying to use EmailSend to send an alarm when the temperature reach a threshold.
I used a very simple code posted in this forum but It does not work.
With device Config utility, i filled all the TCP/IP information (Gateway, dns). I enabled the TLS.
Here is the program i use:
Public Batt_Volt
Public PTemp
Const ServerAddr="smtp.googlemail.com:465"
Const ToAddr="aubert.c@gmail.com"
Const FromAddr="aubert.c@gmail.com"
Const Subject="Email From Test Campbell"
Const Attach=""
Const UserName="aubert.c@gmail.com"
Const Password="xxxx"
Const CRLF = CHR(13)+CHR(10)
Public Result As String * 50
Public AlarmTrigger As Boolean
Public Message As String * 250
Public EmailSuccess As Boolean
Units PTemp = degC
Units Batt_Volt=Volts
DataTable(Test,True,-1)
DataInterval(0,1,Min,10)
Minimum (1,Batt_Volt,FP2,0,False)
Sample (1,PTemp,FP2)
EndTable
BeginProg
Scan(2,Sec,1,0)
Battery(Batt_Volt)
PanelTemp (PTemp,250)
CallTable(Test)
NextScan
SlowSequence
Scan(1,min,1,0)
If AlarmTrigger = False Then
If PTemp > 18 Then AlarmTrigger = True
If AlarmTrigger Then
Message = "Warning!" + 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 + "The temperature is " + PTemp + " degrees C." + CRLF + CRLF + CRLF
Message = Message + "Datalogger time is " + Status.Timestamp
EmailSuccess=EMailSend (ServerAddr,ToAddr,FromAddr,Subject,Message,Attach,UserName,Password,Result)
EndIf
EndIf
If PTemp < 18 Then AlarmTrigger=False
NextScan
EndProg
I get the EmailSuccess variable to False and I do not know what is goign wrong.
In devic config utility, I use the Iptrace code to check the network activity with hyperterminal but I do not know the meaning of the errors.
Here is part of the errors:
11:13:45.62 name: googlemail-smtp.l.google.com,
Aliases: smtp.googlemail.com,
IPv4 addrs: 173.194.67.16,
Age (in seconds): 105, Expires in 300 seconds (ttl)
11:13:45.62 bigfreeq: head:003BC97C, tail:003BCFBC, len:32, min:31, max:32
11:13:45.63 lilfreeq: head:003B4BDC, tail:003B4D2C, len:60, min:56, max:60
11:13:45.63 rcvdq: head:00000000, tail:00000000, len:0, min:0, max:4
11:13:45.63 mfreeq: head:003B2234, tail:003B2260, len:187, min:184, max:187
11:13:45.64 mbufq: head:00000000, tail:00000000, len:0, min:0, max:3
11:13:45.64 soq: head:003F3694, tail:003F33C4, len:6, min:0, max:6
11:13:45.65 inpfreeq: head:003F4A08, tail:003F3724, len:94, min:94, max:100
11:13:45.65 soqfreeq: head:003F3334, tail:003EFEE4, len:94, min:94, max:100
11:13:45.66 tphfreeq: head:003EFE84, tail:003EEC24, len:99, min:99, max:100
11:13:45.66 tcbfreeq: head:003EE7E0, tail:003EAF34, len:94, min:94, max:100
11:13:45.67 ET0 ip=152.77.120.118
11:13:45.67 Comms Mem lens mins: tiny 99 98, lil 99 98, med 45 42, big 21 21, lge 2 2
Can anybody help on this topic?
Regards,
Coralie
Please check this other thread:
https://www.campbellsci.com/forum/messages.cfm?threadid=6AC243CC-96BE-4269-B2F1BEA88862AA48
You need to change the port you are using (for TLS) and check the security settings on your gmail account to make sure application specific passwords is not being enforced.