Welcome to the Protogrid Developer Wiki. A place to gather all the documentation and tips&tricks regarding Protogrid.

JSON API Endpoint mailsend


[GET, POST] Send an email using the provided data

The following JSON data fields or URL parameters can be used:

  • to: TO address (multiple addresses separated by comma)
  • cc: CC address (multiple addresses separated by comma)
  • bcc: BCC address (multiple addresses separated by comma)
  • replyto: ReplyTo address
  • subject: Subject in plain text
  • body: Body text in plain text format (URL encoded)
  • bodyhtml: Body text in HTML format (URL encoded). If both body and bodyhtml are specififed, only bodyhtml will be used
  • attachments: weblink to attachment (URL encoded), multiple links separated by comma

Combinations of JSON data fields and URL parameters are allowed, whereas JSON data fields take precendence over URL parameters

The mail will be sent according to the currently logged in user (mail address specified in user profile, and the fields “SMTP Server Hostname”, “SMTP Server Port” and “SMTP Server Password”).

The function will fist try to establish a TLS session to the specified mail server and authenicate using the supplies credentials. If TLS is not available it will try to connect using SSL. Finally if SSL is not available the function tries to connect using unsecured SMTP protocol.

The returned result will contain the key success with a value of true or a corresponding error message.

Example request:


Example result:

   "errors" : [],
   "protogrid_environment_version" : "2.1.3",
   "result": {"success":true}

Example client-side jQuery function to send mail in web application

$.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));
    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));