{"id":6509,"date":"2022-01-09T20:54:12","date_gmt":"2022-01-09T19:54:12","guid":{"rendered":"https:\/\/help.cirrus-shield.com\/docs\/developer-guide\/rest-api\/sendemail\/"},"modified":"2022-03-06T00:52:27","modified_gmt":"2022-03-05T23:52:27","slug":"sendemail","status":"publish","type":"docs","link":"https:\/\/help.cirrus-shield.com\/en\/docs\/developer-guide\/rest-api\/sendemail\/","title":{"rendered":"8. SendEmail"},"content":{"rendered":"\n<ul class=\"wp-block-list\"><li><strong><span class=\"has-inline-color has-luminous-vivid-orange-color\"><u>URL:<\/u> <\/span><\/strong><\/li><\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>\u00ab \/RestApi\/<a href=\"URL: \n\n\n\n\u00ab \/RestApi\/UploadFile\u00bb\n\n\n\nM\u00e9thode:&nbsp;POSTParam\u00e8tres URL:authToken &#91;string] &#91;Required]=l'authentication tokenfileName &#91;string] &#91;Required]=le nom du champ que l'utilisateur veut importerobjectName &#91;string] &#91;Required]=le nom de l'enregistrement de l'objet dans lequel l'utilisateur veut importer un fichierfieldName &#91;string] &#91;Required]=le nom API name du champ dans lequel le fichier va \u00eatre import\u00e9RecGUID &#91;long] &#91;Required]=l'enregistrement Id dans CirrusShield dans lequel le fichier va \u00eatre import\u00e9Param\u00e8tres de donn\u00e9es:dataStream =les donn\u00e9es du fichier import\u00e9\n\n\n\nExample:\n\n\n\n\/\/ Get file name\n\n$fileName = $_FILES&#91;'file_upl']&#91;'name'];\n\/\/ Get file content\n\n$data = file_get_contents($_FILES&#91;'file_upl']&#91;'tmp_name']);\n\/\/ Transform file content to json array\n\n$array = array();\n\nforeach(str_split($data) as $char){\narray_push($array, ord($char));\n}\n\/\/ Send the Data Params\n\ncurl_setopt($client, CURLOPT_POSTFIELDS, &quot;=&quot;.json_encode($array));\n<form name=&quot;file_up&quot; action=&quot;UploadFile.php&quot; method=&quot;POST&quot; enctype=&quot;multipart\/form-data&quot;>\nUpload your file here\n\n<input type=&quot;file&quot; name=&quot;file_upl&quot; id=&quot;file_upl&quot;\/>\n\n<input type=&quot;submit&quot; name=&quot;action&quot; value=&quot;submit&quot;\/>\n<\/form>\n\n\n\nR\u00e9ponse de succ\u00e8s:Status Code=200 (OK)R\u00e9ponse d'erreur:Status Code=400 (BadRequest) (au cas o\u00f9 il y a une erreur dand les donn\u00e9es JSON envoy\u00e9es dans le HTTP Post Request body ou le nom de l'objet, nom champ API dans l'objet ou dans l'enregistrement Id est incorrect)\">SendEmail<\/a>\u00bb<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\"><li><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-luminous-vivid-orange-color\"><u>Method:<\/u>\u00a0<\/mark><\/strong>POST<br><\/li><li><strong><u><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-luminous-vivid-orange-color\">URL Settings:<\/mark><\/u><\/strong><ul><li>authToken [string] [Required]=Authentification Token Id.<\/li><li>emailFrom [string] [Required]=The email address of the sender. This setting must have one of these two values: \u201cOrg\u201d or \u201cCurrentUser\u201d. If the value is &#8220;Org&#8221; then the sender&#8217;s email will be the one defined on the Organization page of the Configuration menu. If the value is &#8220;CurrentUser&#8221; then the sender&#8217;s email will be the one of the logged in user (the one that enabled the authentication token to be generated).<\/li><\/ul><ul><li>emailTo [string] [Required]=the recipient&#8217;s email address (es). If there are several values, separate them with &#8220;;&#8221;.<\/li><li>emailCC [string] [Required]=the email address (es) to be copied. If there are several values, separate them with &#8220;;&#8221;.<\/li><li>emailBCC [string] [Required]=the email address to be cached. If there are several values, separate them with &#8220;;&#8221;.<\/li><li>emailReplyTo [string] [Required]=the email address that will receive the email in case of a response.<\/li><li>emailSubject [string] [Required]=the email subject<\/li><li>emailIsBodyHtml [boolean] [Required]= allows you to define whether the body of the email is in text or in HTML. Possible values: true or false.<\/li><li>enableSsl [boolean] [Required]=allows you to specify whether the connection to the SMTP server must be done in SSL or not. Possible values: true or false.<\/li><\/ul><\/li><\/ul>\n\n\n\n<p><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong><u><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-luminous-vivid-orange-color\">Message body<\/mark><\/u><\/strong><ul><li>= the body of the email in text or HTML (when emailIsBodyHtml is true)<\/li><\/ul><\/li><\/ul>\n\n\n\n<p><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong><u><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-luminous-vivid-orange-color\">Success Response:<\/mark><\/u><\/strong><ul><li>Status Code=200 (OK)<br><\/li><\/ul><\/li><li><strong><u><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-luminous-vivid-orange-color\">Error Response:<\/mark><\/u><\/strong><ul><li>Status Code=400 (BadRequest) (in case there is an error in the data sent in the request)<\/li><li>Status Code=400 (Email not sent) : when there is no SMTP server defined on the user (emailFrom = CurrentUser) or on the organization (emailFrom = Org)<\/li><\/ul><\/li><\/ul>\n\n\n\n<p><\/p>\n\n\n\n<p><strong>Note<\/strong><\/p>\n\n\n\n<p><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>The SendEmail() method uses the SMTP configuration defined on the Organization page (emailFrom = Org) or on the current user (emailFrom = CurrentUser) in the setup area. If no SMTP server and credentials are defined, the SendEmail() method will return a message &#8220;400 Email was not sent&#8221;.<\/li><li>When enableSsl is set to true, the SendEmail() method uses STARTTLS (usually on port 587). The alternate connection method, sometimes called SMTP\/SSL (by default uses port 465), is currently not supported.<\/li><\/ul>\n\n\n\n<p><\/p>\n","protected":false},"author":1,"featured_media":0,"parent":944,"menu_order":7,"comment_status":"open","ping_status":"closed","template":"","meta":{"_et_pb_use_builder":"","_et_pb_old_content":"","_et_gb_content_width":"","_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0,"footnotes":""},"doc_tag":[],"class_list":["post-6509","docs","type-docs","status-publish","hentry"],"comment_count":0,"_links":{"self":[{"href":"https:\/\/help.cirrus-shield.com\/en\/wp-json\/wp\/v2\/docs\/6509","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/help.cirrus-shield.com\/en\/wp-json\/wp\/v2\/docs"}],"about":[{"href":"https:\/\/help.cirrus-shield.com\/en\/wp-json\/wp\/v2\/types\/docs"}],"author":[{"embeddable":true,"href":"https:\/\/help.cirrus-shield.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/help.cirrus-shield.com\/en\/wp-json\/wp\/v2\/comments?post=6509"}],"version-history":[{"count":7,"href":"https:\/\/help.cirrus-shield.com\/en\/wp-json\/wp\/v2\/docs\/6509\/revisions"}],"predecessor-version":[{"id":6984,"href":"https:\/\/help.cirrus-shield.com\/en\/wp-json\/wp\/v2\/docs\/6509\/revisions\/6984"}],"up":[{"embeddable":true,"href":"https:\/\/help.cirrus-shield.com\/en\/wp-json\/wp\/v2\/docs\/944"}],"next":[{"title":"9. SendEmailWithAttachments","link":"https:\/\/help.cirrus-shield.com\/en\/docs\/developer-guide\/rest-api\/sendemailwithattachments\/","href":"https:\/\/help.cirrus-shield.com\/en\/wp-json\/wp\/v2\/docs\/6517"}],"prev":[{"title":"7. DownloadFile","link":"https:\/\/help.cirrus-shield.com\/en\/docs\/developer-guide\/rest-api\/downloadfile\/","href":"https:\/\/help.cirrus-shield.com\/en\/wp-json\/wp\/v2\/docs\/6535"}],"wp:attachment":[{"href":"https:\/\/help.cirrus-shield.com\/en\/wp-json\/wp\/v2\/media?parent=6509"}],"wp:term":[{"taxonomy":"doc_tag","embeddable":true,"href":"https:\/\/help.cirrus-shield.com\/en\/wp-json\/wp\/v2\/doc_tag?post=6509"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}