Appendix C. EmailSend Using the Gmail Outgoing SMTP Server
C-2
Email to Text Message Gateways
T-Mobile:
Virgin Mobile:
AT&T:
Sprint:
Verizon:
EmailSend Program Example
The following example sends an email message when an alarm condition is
True.
Both the CR1000 and Raven modem must be configured as PPP as
described in Appendix B. Transport Layer Security (TLS) must be
enabled in the datalogger to use the Gmail mail server.
'Main program variables
Public Batt, RefTemp, Temp
Public Socket AS Long
'declare Email parameter strings (as constants), Message String & Result Variable
Const ServerAddr="smtp.gmail.com"
Const UserName="gmail account name"
Const Password="datalogger"
Const ToAddr="[email protected], [email protected]"
Const FromAddr="[email protected]"
Const Subject="Email Message Test"
Const Attach=""
Const CRLF = CHR(13)+CHR(10)
Public Result as String * 100
Public AlarmTrigger As Boolean
Public Message As String * 250
Public EmailSuccess As Boolean
DataTable (TenSecData,True,-1)
DataInterval (0,10,Sec,10)
Sample (1,Batt,FP2)
Sample (1,Temp,FP2)
EndTable
BeginProg
Scan (1,Sec,3,0)
Battery (Batt)
PanelTemp (RefTemp,250)
TCDiff (Temp,1,mV2_5C,1,TypeT,RefTemp,True ,0,250,1.0,0)
CallTable TenSecData
NextScan
SlowSequence
Scan(1,sec,1,0)
If AlarmTrigger = False Then
If Temp > 27 Then AlarmTrigger = True
If AlarmTrigger Then
Message = "Warning!" + CRLF + CRLF
Message = M "An alarm condition has been identified. "
Message = M "The temperature is " + Temp + " degrees C." + CRLF + CRLF
Message = M "Datalogger time is " + Status.Timestamp
EmailSuccess=EmailSend (ServerAddr,ToAddr,FromAddr,Subject,Message,Attach,UserName,Password,Result)
EndIf
EndIf
If Temp < 27 Then AlarmTrigger=False
NextScan
EndProg
Содержание RavenXTV
Страница 2: ......
Страница 32: ...Appendix A AceManager Setup without Template File A 4 This is a blank page...
Страница 39: ......