Is it possible to have an email sent (to a list of recipients) whenever a point is added to a hosted File GDB on a public web-app?
The idea is to originate a permit application process from a web-map/app: applicants can add a point for the location they need a permit for, enter their information and apply for a permit (of particular kind). An email alerts officials that a permit has been applied for. The rest of the approval process flow from there and the hosted data is used to collect applicant information (including location for permit) as well as flag the status of the application as it makes its way through various stages of the approval process.
Any ideas on how to have edits trigger emails?
Solved! Go to Solution.
Can you turn the service back on, i tried to test your script but it is failing because it is disabled.
but just from what i can see, you will need to change lines 35 and use your Created Date field instead of my ['Date_Notified'] field. Also you need to remove the zone = feat... line and fix line 40 to be something like
if createDate > t:
let me know when you turn the service back on and i will check some more.
I took your script and rewrote some parts of it, the finished copy is located here: https://ufile.io/9emzw
It queries your REST service and returns all records, from all the records it finds any record with a create date made in the last 10 days, it then creates a list of those and formats them into an email (body, subject, etc...)
The rest of the email part you will have to put in your email server and credentials to complete.
Subject: You Have 4 New Service Request(s) Added to the GIS Records since: 2019-03-31 18:46:55\n
\n1) Feature with ID # 0145 created on 2019-04-05 14:26:42 was added to the GIS Records. LOCATION: 1526 NW 89 CT\n\tSUMMARY: 201705896\r
\n2) Feature with ID # 0145 created on 2019-04-05 20:20:23 was added to the GIS Records. LOCATION: 5200-5292 NW 84th Ave, Miami, Florida, 33166\n\tSUMMARY: TEST\r
\n3) Feature with ID # 0144 created on 2019-04-05 20:23:20 was added to the GIS Records. LOCATION: 4800 NW 79th Ave, Miami, Florida, 33166\n\tSUMMARY: TEST\r
\n4) Feature with ID # 0145 created on 2019-04-08 14:22:06 was added to the GIS Records. LOCATION: 8401 NW 53 TER\n\tSUMMARY: TEST\n'
That is how the email will look (ignore the character tabs and escapes, outlook will format them as HTML)
Thank you for your assistance. I revised and input email server/credentials. I tried to run it. Please see screenshot. I am using 2.7.13 python.. Am I doing anything incorrect?
what line is it saying your error is in? i would also use pyscripter as your IDE, it gives much better information about errors.
The script (lines 1-74) runs perfectly for me, i did not not mess with the smtp part at the bottom (lines 75-82)
so i would imagine your syntax error is in lines 75 to 82. I would look up the documentation on SMTP and then make yours look like that.