Hotspot Email Trial User Data

This script will make and Email a CSV-list of Trial Users and their usage.

!!! : Make sure that Email from the router is working.

:local emailaddress "YOURMAIL@YOURDOMAIN.COM"
:local date [/system clock get date]
:local emailsubject
:local emailbody
:local freeusers
:local trialuser
:local bdown
:local bup
:local pdown
:local pup
:set freeusers "Name,Packets-Upload,Packets-Download,Bytes-Upload,Bytes-Download"
:foreach counter in=[/ip hotspot user find where dynamic=yes] do={
:set trialuser [/ip hotspot user get $counter name]
:set bup [/ip hotspot user get $counter bytes-in]
:set bdown [/ip hotspot user get $counter bytes-out]
:set pup [/ip hotspot user get $counter packets-in]
:set pdown [/ip hotspot user get $counter packets-out]
:set freeusers "$freeusers\r\n$trialuser,$pup,$pdown,$bup,$bdown"
}


:set emailsubject "Trial Users ($date)"
:set emailbody "$freeusers\r\n\r\n"
/tool e-mail send to="$emailaddress" subject="$emailsubject" body="$emailbody"

hi do you chek this ?
is it work ?
thx

I want to receive an email each hour showing for each user the bytes-in and bytes out, either in that hour or accumulative, until I reset the counters.

Can this script be modified to do this?

Thanks

Paul