Moved email logic to server. Untested code. POST to /email with patient ID sent as "id" to trigger.