num_rows < 1) { echo '{"error":"device id does not exist"}'; error_log("Device id does not exist\n", 3, "lipa.log"); exit; } $to = 'trigger@recipe.ifttt.com'; $subject = '#send'; $headers = 'From: avanstwitter@gmail.com' . "\r\n"; $mailbody = $body . " - #" . $id; //If body is too long (over 140 char's), only send first 140 characters if(strlen($mailbody) > 140){ $mailbody = substr($mailbody, 0, 140); } mail($to, $subject, $mailbody, $headers); error_log("Email sent successfully: $mailbody\n", 3, "lipa.log"); echo '{"success":"true"}'; ?>