what if you want to know what happened yesterday on site? What if your customer wants this but you don't want them to have access to the system?
With Crimson 3.1 you can easily email a daily log file from your company email or even with free email accounts such as gmail and outlook.
To get started you will need to set up logging in Crimson 3.1, ensure the device has an internet connection and obtain the email server details.
Enter your email server details into the SMTP tab of the mail manager, don’t forget to add in the reverse path (Sender address) and Contacts (Recipient address).
Common Email Server Settings
Gmail Settings
Server IP Address:smtp.gmail.com
Server Port Number:587
Outlook Settings
Server IP Address: smtp-mail.outlook.com
Server Port Number:587
Now to actually send the email we will need to write some code to know when to send the log file and which file to send. As the default logging creates a new log file every day we can simply send yesterday’s once a new day has started.
The Initialisation function will set the log directory and initial date file when the device powers up
Program1 call the function to send yesterday’s log file and then update the date today at ten seconds past midnight.
Send Log will increment the number of emails sent and send the log file as an email attachment with the subject line “Site # Log File”.
Note: Most email servers will limit attachments to either 25 or 50 MB. One last thing to do is configure Initialisation to be called on startup andProgram1 to be called every second, which is done under Display Pages >Pages >Start Up and On Tick
And the following Data Tags and Data Log have been created.
Now you should be able to read your logs over your morning cup of coffee!
|