Next revision | Previous revisionLast revisionBoth sides next revision |
protogrid:json_api_endpoint_mailsend [2020-07-23 16:30] – created mha | protogrid:json_api_endpoint_mailsend [2020-07-28 08:29] – [Example client-side jQuery function to send mail in web application] 85.1.6.98 |
---|
====== Json Api Endpoint Mailsend ====== | ====== JSON API Endpoint mailsend ====== |
| |
/api/v2/apps/<app_name>/mailsend | /api/v2/apps/<app_name>/mailsend |
Example request: | Example request: |
<code> | <code> |
http://example.protogrid.com/api/v2/apps/example/mailsend?to=user1@example.com&cc=user2@example.com&subject=example&bcc=user@example.com&replyto=user@example.com&body=&bodyhtml=%3Chtml%3E%0A%3Cbody%3E%0A%0A%3Ch1%3EMy%20First%20Heading%3C%2Fh1%3E%0A%3Cp%3EMy%20first%20paragraph.%3C%2Fp%3E%0A%0A%3C%2Fbody%3E%0A%3C%2Fhtml%3E&attachments=https%3A%2F%2Fprotogrid.wiki%2Flib%2Ftpl%2Fpgrid-vector%2Fuser%2Flogo.png | https://example.protogrid.com/api/v2/apps/example/mailsend?to=user1@example.com&cc=user2@example.com&subject=example&bcc=user@example.com&replyto=user@example.com&body=&bodyhtml=%3Chtml%3E%0A%3Cbody%3E%0A%0A%3Ch1%3EMy%20First%20Heading%3C%2Fh1%3E%0A%3Cp%3EMy%20first%20paragraph.%3C%2Fp%3E%0A%0A%3C%2Fbody%3E%0A%3C%2Fhtml%3E&attachments=https%3A%2F%2Fprotogrid.wiki%2Flib%2Ftpl%2Fpgrid-vector%2Fuser%2Flogo.png |
</code> | </code> |
| |
<code json> | <code json> |
{ | { |
"errors": [], | "errors" : [], |
"protogrid_environment_version": "1.3.9", | "protogrid_environment_version" : "2.1.3", |
"result": [ | "result": {"success":true} |
"success": "true" | |
] | |
} | } |
| </code> |
| |
| |
| ==== Example client-side jQuery function to send mail in web application ==== |
| |
| <code json> |
| |
| $.get("https://example.protogrid.com/api/v2/apps/example/mailsend?to=user@example.com&subject=Test&body=This%20is%20a%20testmessage", function(data, status){ |
| alert("Data: " + JSON.stringify(data)); |
| }); |
| |
| $.post({ |
| url: "https://example.protogrid.com/api/v2/apps/example/mailsend", |
| data: JSON.stringify({ |
| "to": "user@example.com", |
| "cc": "user2@example.com", |
| "subject": "Test", |
| "body": "This%20is%20a%20testmessage", |
| }), |
| contentType: 'application/json; charset=utf-8' |
| }).done(function (response) { |
| alert("Data: " + JSON.stringify(response)); |
| }); |
| |
</code> | </code> |