{"id":6517,"date":"2022-01-09T21:13:16","date_gmt":"2022-01-09T20:13:16","guid":{"rendered":"https:\/\/help.cirrus-shield.com\/docs\/developer-guide\/rest-api\/sendemailwithattachments\/"},"modified":"2022-01-11T09:43:01","modified_gmt":"2022-01-11T08:43:01","slug":"sendemailwithattachments","status":"publish","type":"docs","link":"https:\/\/help.cirrus-shield.com\/en\/docs\/developer-guide\/rest-api\/sendemailwithattachments\/","title":{"rendered":"9. SendEmailWithAttachments"},"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><span class=\"has-inline-color has-luminous-vivid-orange-color\"><u>Method:<\/u>\u00a0<\/span><\/strong>POST<br><\/li><li><strong><u><span class=\"has-inline-color has-luminous-vivid-orange-color\">URL Settings:<\/span><\/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 \u201cOrg\u201d then the sender\u2019s email will be the one defined on the Organization page of the Configuration menu. If the value is \u201cCurrentUser\u201d then the sender\u2019s 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\u2019s email address (es). If there are several values, separate them with \u201c;<\/li><li>emailCC [string] [Required]=the email address (es) to be copied. If there are several values, separate them with \u201c;\u201d.<\/li><li>emailBCC [string] [Required]=the email address to be cached. If there are several values, separate them with \u201c;\u201d.<\/li><li>emailReplyTo [string] [Required]=the email address to be cached. If there are several values, separate them with \u201c;\u201d.<\/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><li>emailBodyAndAttachments [JObject] [Required]=the body and attachments of the email stored in a subject.<\/li><\/ul><\/li><\/ul>\n\n\n\n<ul class=\"wp-block-list\"><li><strong><u><span class=\"has-inline-color has-luminous-vivid-orange-color\">Success Response:<\/span><\/u><\/strong><ul><li>Status Code=200 (OK)<br><\/li><\/ul><\/li><li><strong><u><span class=\"has-inline-color has-luminous-vivid-orange-color\">Error Response:<\/span><\/u><\/strong><ul><li>Status Code=400 (BadRequest) (in case there is an error in the data sent in the request)<\/li><\/ul><\/li><\/ul>\n\n\n\n<p><\/p>\n\n\n\n<p><strong>Note<\/strong><\/p>\n\n\n\n<p>The SendEmail () method uses the SMTP configuration defined on the Organization page in the configuration area. If no SMTP server and credentials are defined, the SendEmail () method will default to the SMTP credentials defined at the current user level.<\/p>\n\n\n\n<p><\/p>\n","protected":false},"author":1,"featured_media":0,"parent":944,"menu_order":8,"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-6517","docs","type-docs","status-publish","hentry"],"comment_count":0,"_links":{"self":[{"href":"https:\/\/help.cirrus-shield.com\/en\/wp-json\/wp\/v2\/docs\/6517","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=6517"}],"version-history":[{"count":3,"href":"https:\/\/help.cirrus-shield.com\/en\/wp-json\/wp\/v2\/docs\/6517\/revisions"}],"predecessor-version":[{"id":6530,"href":"https:\/\/help.cirrus-shield.com\/en\/wp-json\/wp\/v2\/docs\/6517\/revisions\/6530"}],"up":[{"embeddable":true,"href":"https:\/\/help.cirrus-shield.com\/en\/wp-json\/wp\/v2\/docs\/944"}],"next":[{"title":"Source code examples","link":"https:\/\/help.cirrus-shield.com\/en\/docs\/developer-guide\/rest-api\/source-code-examples\/","href":"https:\/\/help.cirrus-shield.com\/en\/wp-json\/wp\/v2\/docs\/6450"}],"prev":[{"title":"8. SendEmail","link":"https:\/\/help.cirrus-shield.com\/en\/docs\/developer-guide\/rest-api\/sendemail\/","href":"https:\/\/help.cirrus-shield.com\/en\/wp-json\/wp\/v2\/docs\/6509"}],"wp:attachment":[{"href":"https:\/\/help.cirrus-shield.com\/en\/wp-json\/wp\/v2\/media?parent=6517"}],"wp:term":[{"taxonomy":"doc_tag","embeddable":true,"href":"https:\/\/help.cirrus-shield.com\/en\/wp-json\/wp\/v2\/doc_tag?post=6517"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}