Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
protogrid:api_endpoints [2021-12-02 12:17] – [/api/v2/apps/<app_name>/mailsend] druprotogrid:api_endpoints [2021-12-20 15:38] (current) – [/api/v2/apps/<app_name>/protos/<proto_key>/card-keys] dru
Line 143: Line 143:
     * Example: limit=15     * Example: limit=15
     * Default value: 10     * Default value: 10
-  * descending: If set to true the results will be in descending order.+  * descending: If set to true the results will be in descending order. If set to true start_key and end_key must be exchanged.
     * Example: descending=true     * Example: descending=true
     * Default value: False     * Default value: False
Line 152: Line 152:
  
          
-Noteyou may only use either keys or start_key and end_key.+Please note: 
 +  * You may only use either "keysor "start_keyand "end_key". 
 +  * Key values must be cut off after 300 characters (e. g. string values and sortstrings) because these values are also cut off in the view index.
  
 Details: For more details about the URL parameters see the [[http://docs.couchdb.org/en/stable/api/ddoc/views.html|CouchDB documentation]]. Details: For more details about the URL parameters see the [[http://docs.couchdb.org/en/stable/api/ddoc/views.html|CouchDB documentation]].
Line 446: Line 448:
   "result": [   "result": [
     "card_keys":[     "card_keys":[
 +      "ExampleProtoKey",
 +      "ExampleSortstring",
       "ExampleCardKey"       "ExampleCardKey"
     ],     ],
Line 456: Line 460:
 [POST] Send an email [POST] Send an email
  
-To use this endpoint, mail server must be specified in the environment properties (fields "SMTP Server Hostname" and "SMTP Server Port"). The mail will be sent according to the currently logged in user (mail address specified in user profile and the field "SMTP Server Password" if requested by the mailserver)+To be able to use this endpoint, the SMTP mail server of your organization must first be configured as the designated mail relay server in your Environment. If this has not been done yet, please contact [[protogrid-customer-support@ategra.ch|Protogrid Support]].
  
-Protogrid will fist try to establish a TLS session to the specified mail server and authenticate using the supplied 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.+Protogrid will fist try to establish a TLS session to the specified mail relay server and authenticate using the supplied 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.
  
-If Sender Policy Framework (SPF) is used for the particular mail domain, the Protogrid server must be added to the SPF record of this domain. For this purpose, please contact [[protogrid-customer-support@ategra.ch|Protogrid Support]].+The mail will be sent according to the currently logged in user (mail address specified in user profile and the field "SMTP Server Password" if requested by the mailserver).
  
 The following JSON data fields can be used: The following JSON data fields can be used:
Line 491: Line 495:
     url: "https://example.protogrid.com/api/v2/apps/example/mailsend",     url: "https://example.protogrid.com/api/v2/apps/example/mailsend",
     data: JSON.stringify({     data: JSON.stringify({
-        "to": ["Tester 1 <test1@ategra.ch>", "Tester 2 <test2@ategra.ch>"], +        "to": ["Tester 1️⃣ <test1@ategra.ch>", "Tester 2️⃣ <test2@ategra.ch>"], 
-        "cc": ["Tester 3 <test3@ategra.ch>", "Tester 4 <test4@ategra.ch>"], +        "cc": ["Tester 3️⃣ <test3@ategra.ch>", "Tester 4️⃣ <test4@ategra.ch>"], 
-        "bcc": ["Tester 5 <test5@ategra.ch>", "Tester 6 <test6@ategra.ch>"], +        "bcc": ["Tester 5️⃣ <test5@ategra.ch>", "Tester 6️⃣ <test6@ategra.ch>"], 
-        "reply_to": ["Tester 7 <test7@ategra.ch>", "Tester 8 <test8@ategra.ch>"], +        "reply_to": ["Tester 7️⃣ <test7@ategra.ch>", "Tester 8️⃣ <test8@ategra.ch>"], 
-        "from": "Tester 0 <test0@ategra.ch>", +        "from": "Tester 0️⃣ <test0@ategra.ch>", 
-        "subject": "Test Email", +        "subject": "Test Email with Emojis 👍", 
-        "body_text_plain": "This is a test message in plain text.", +        "body_text_plain": "This is a test message in plain text 😎.", 
-        "body_text_html": "This is a <b>test</b> message.<br><br>Please check if the message is displayed correctly using several different mail clients or tools like Mailtrap (<a href='https://mailtrap.io'>link</a>).<br><br><img src='cid:logo.png'></img>",+        "body_text_html": "This is a <b>test</b> message 🤖.<br><br>Please check if the message is displayed correctly using several different mail clients or tools like Mailtrap (<a href='https://mailtrap.io'>link</a>).<br><br><img src='cid:logo.png'></img>",
         "inline_images": [         "inline_images": [
             {"card_id": "ffc3a027-2fed-45f8-8aa8-adec18a90439", "file_name": "logo.png"}             {"card_id": "ffc3a027-2fed-45f8-8aa8-adec18a90439", "file_name": "logo.png"}
Line 512: Line 516:
 </code> </code>
  
 +As a response you receive a JSON with the following structure:
 +  * errors [Array]: Contains information if no single email could be sent, otherwise it is empty.
 +  * messages [Array]: Contains information if Protogrid could not establish the connection to the mail server with the most secure transport encryption, otherwise it is empty.
 +  * result [Object]: Contains information regarding individual recipients to whom the email could not be delivered. If the email could be delivered to all recipients equals to { "success": true }.
  
-Example result:+Example response:
 <code javascript> <code javascript>
 { {
-  "errors": [],  +    "errors": [], 
-  "result": { +    "messages": 
-    "success": true +    [ 
-  }+        "Couldn't send the mail using a secure TlS communication channel. Trying SSL instead.", 
 +        "Couldn't send the mail an SSL communication channel. Trying without encryption." 
 +    ], 
 +    "result": 
 +    
 +        "external@recipient.ch": 
 +        [ 
 +            554, 
 +            "5.7.1 <external@recipient.ch>: Relay access denied" 
 +        ] 
 +    }
 } }
 </code> </code>
Print/export