>*!* { >*!* "api_key": "api-40246460336B11E6AA53F23C91285F72", >*!* "to": ["Test Person <test@example.com>"], >*!* "sender": "Test Persons Friend <test2@example.com>", >*!* "subject": "Hello Test Person", >*!* "text_body": "You're my favorite test person ever", >*!* "html_body": "<h1>You're my favorite test person ever</h1>", >*!* "custom_headers": [ >*!* { >*!* "header": "Reply-To", >*!* "value": "Actual Person <test3@example.com>" >*!* } >*!* ], >*!* "attachments": [ >*!* { >*!* "filename": "test.pdf", >*!* "fileblob": "--base64-data--", >*!* "mimetype": "application/pdf" >*!* }, >*!* { >*!* "filename": "test.txt", >*!* "fileblob": "--base64-data--", >*!* "mimetype": "text/plain" >*!* } >*!* ] >*!* } >>
>lcFilePath = "Costs_Preprocess.pdf" >lcBase64 = FILETOSTR(lcFilePath) && Read the contents of the file into a string >lcBase64 = STRCONV(lcBase64, 13) && STRCONV with 13 parameter means Base64 encoding >STRTOFILE(lcBase64, "Costs.pdf") > > >TEXT TO lcJson >{ > "api_key": "api-40246460336B11E6AA53F23C91285F72", > "to": ["Moi <info@gestion-beaute.com>"], > "sender": "Encore moi <testmlm@gestion-beaute.com>", > "subject": "#1 Hello à moi", > "text_body": "Je peux juste espérer.", > "custom_headers": [ > { > "header": "Reply-To", > "value": "Denis Chassé <d.chasse@gestion-beaute.com>" > } > ], > "attachments": [ > { > "filename": "Costs.pdf", > "fileblob": "--base64-data--", > "mimetype": "application/pdf" > } > ] >} >ENDTEXT > >loProxy = CREATEOBJECT("wwJsonServiceClient") >lcJson = loProxy.CallService("https://api.smtp2go.com/v3/email/send",lcJson,"POST") >loProxy = null >>
>{"request_id": "cbe76704-beb9-11ee-8cdc-f23c9216ce11", "data": {"error": "An error occurred processing the json data you sent with the request, please make sure the data conforms to the specification for this call (see the documentation here: https://apidoc.smtp2go.com/documentation/#/README) and try again. Don't forget to set Content-Type to 'application/json'.", "error_code": "E_ApiResponseCodes.NON_VALIDATING_IN_PAYLOAD", "field_validation_errors": {"fieldname": "fileblob", "message": "The field 'fileblob' was expecting a base64 encoded value but instead found '--base64-data--', Please correct your JSON payload and try again."}}} >>
>"fileblob": "--base64-data--", >>with
>"fileblob": "base64 encoded", >>
"fileblob": "--base64-data--"
"fileblob": "<<lcBase64>>"