Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/276.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 嵌入式发送文档中的角色名称_Php_Curl_Docusignapi - Fatal编程技术网

Php 嵌入式发送文档中的角色名称

Php 嵌入式发送文档中的角色名称,php,curl,docusignapi,Php,Curl,Docusignapi,我正在使用docusignrestapi。我正在尝试创建一个模板,然后使用嵌入式发送 这是我的密码: 创建模板: 当我点击上面的url时,我会看到一个页面,在那里我可以标记并发送文档。有一个电子邮件地址 此页面中自动填充$recipient_电子邮件的字段。但问题是邮件不会发送到收件人的电子邮件地址。谢谢。另外,我没有收到任何错误消息。您的代码没有问题,并且按照预期工作正常。我可以看出您使用的是DocuSign的示例代码 如果你说一切正常,没有错误,但在导航到嵌入式发送URL并发送文档供签名后,

我正在使用docusignrestapi。我正在尝试创建一个模板,然后使用嵌入式发送

这是我的密码:

创建模板:

当我点击上面的url时,我会看到一个页面,在那里我可以标记并发送文档。有一个电子邮件地址
此页面中自动填充$recipient_电子邮件的字段。但问题是邮件不会发送到收件人的电子邮件地址。谢谢。另外,我没有收到任何错误消息。

您的代码没有问题,并且按照预期工作正常。我可以看出您使用的是DocuSign的示例代码

如果你说一切正常,没有错误,但在导航到嵌入式发送URL并发送文档供签名后,收件人没有收到电子邮件,我会检查安全软件、垃圾邮件/垃圾邮件过滤器、防火墙等。DocuSign服务的使用非常广泛,如果电子邮件没有在签名请求中发出,那么很快就会有一个很大的臭味,除此之外,我刚刚做了一个测试,我的电子邮件发出得很好


如前所述,如果您确定电子邮件地址正确,并通过用户界面点击发送按钮,我会检查安全软件、垃圾邮件/垃圾邮件过滤器、防火墙,以及其他可能阻止电子邮件到达您身边的任何东西。

另一个解决电子邮件发送问题的建议:使用DocuSign Connect。如果您的帐户配置正确,您可以启用连接并使用连接日志来检测收件人电子邮件是否无法送达,即DocuSign在发送到该地址时是否接收到“回退”

在DocuSign中创建自定义连接配置,如本指南所述:

在您创建的连接配置中,您可以将任何URL指定为要发布到的URL-此测试的所有操作都是使Connect发送收件人已发送事件和收件人传递失败事件的通知,并为其发送的通知创建日志项-您指定的端点不具备接收/处理Connect的能力并不重要信息

在您创建的连接配置中,请确保选择我在此处突出显示的选项,如前所述,您可以使用任何URL-我只是碰巧选择了google.com:

如上所述创建并保存连接配置后,请完成问题中描述的创建/发送信封的过程

发送信封后,以管理员身份登录到DocuSign web控制台,并查看连接日志条目。i、 例如,导航到首选项>>连接>>日志

您应该看到自创建/启用连接配置以来发生的每个已发送收件人和/或收件人传递失败事件的日志条目

通过检查日志条目的内容,您可以确定DocuSign是否成功发送收件人电子邮件,以及收件人电子邮件是否因无法送达而反弹

如果日志条目表明DocuSign正在向收件人发送电子邮件,并且没有显示任何回退,则可能是电子邮件客户端出现问题,阻止收件人按照Ergin在其回答中的建议接收电子邮件

$header = "<DocuSignCredentials><Username>" . $email . "</Username><Password>" . $password . "</Password><IntegratorKey>" . $integratorKey . "</IntegratorKey></DocuSignCredentials>";    

$url = "https://demo.docusign.net/restapi/v2/login_information";
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_HEADER, false);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HTTPHEADER, array("X-DocuSign-Authentication: $header"));

$json_response = curl_exec($curl); 
$status = curl_getinfo($curl, CURLINFO_HTTP_CODE);

if ( $status != 200 ) {
  $status = 'notok';
}

$response = json_decode($json_response, true); 

if( (isset($response['errorCode']))  && ($response['errorCode'] == 'USER_LACKS_PERMISSIONS')) {
  echo $msg = 'This user lacks sufficient permissions';
  $_SESSION['msg_frm_apd'] = $msg;

}



 $accountId = $response["loginAccounts"][0]["accountId"];
$baseUrl = $response["loginAccounts"][0]["baseUrl"];
curl_close($curl);

 $template_name = "template_" . time();

$data = "{
  \"emailBlurb\":\"String content\",
\"emailSubject\":\"String content\",
  \"documents\": [{
\"documentId\": \"1\",
\"name\": \"document.pdf\"
}],
\"recipients\": {
\"signers\": [{
\"recipientId\": \"1\",
\"roleName\": \"Signer 1\"
}]
},
\"envelopeTemplateDefinition\": {
\"description\": \"Description\",
\"name\": \"$template_name\"
}
}";  





$file_contents = file_get_contents("uploads/envelopes/" . $file_name);

$requestBody = "\r\n"
."\r\n"
."--myboundary\r\n"
."Content-Type: application/json\r\n"
."Content-Disposition: form-data\r\n"
."\r\n"
."$data\r\n"
."--myboundary\r\n"
."Content-Type:application/pdf\r\n"
."Content-Disposition: file; filename=\”document.pdf\"; documentid=1 \r\n"
."\r\n"
."$file_contents\r\n"
."--myboundary--\r\n"
."\r\n";


$url = "https://demo.docusign.net/restapi/v2/accounts/376082/templates";


$curl = curl_init($url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $requestBody);                                                                  
curl_setopt($curl, CURLOPT_HTTPHEADER, array(                                                                          
  'Content-Type: multipart/form-data;boundary=myboundary',
  'Content-Length: ' . strlen($requestBody),
  "X-DocuSign-Authentication: $header" )                                                                       
);

$json_response = curl_exec($curl); 
$response = json_decode($json_response, true);


$status = curl_getinfo($curl, CURLINFO_HTTP_CODE);
if ( $status != 201 ) {
  echo "error calling webservice, status is:" . $status . "\nerror text is --> ";
  print_r($json_response); echo "\n";
  exit(-1);
}

$response = json_decode($json_response, true);
$templateId = $response['templateId'];   // provide a valid templateId of a template in your account

  $clientUserId = "1234"; 
  $templateRoleName = "Signer 1";

$data = array("accountId" => $accountId, 
    "emailSubject" => "DocuSign API - Embedded Sending Example",
    "templateId" => $templateId, 
    "templateRoles" => array(
      array( "roleName" => $templateRoleName, "email" => $recipient_email, "name" => $recipient_name, "clientUserId" => $clientUserId )),
    "status" => "created");                                                                    



  $data_string = json_encode($data);  
  $curl = curl_init($baseUrl . "/envelopes" );
  curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
  curl_setopt($curl, CURLOPT_POST, true);
  curl_setopt($curl, CURLOPT_POSTFIELDS, $data_string);                                                                  
  curl_setopt($curl, CURLOPT_HTTPHEADER, array(                                                                          
    'Content-Type: application/json',                                                                                
    'Content-Length: ' . strlen($data_string),
    "X-DocuSign-Authentication: $header" )                                                                docusign       
  );

  $json_response = curl_exec($curl);
  $status = curl_getinfo($curl, CURLINFO_HTTP_CODE);
  if ( $status != 201 ) {
    echo "error calling webservice, status is:" . $status . "\nerror text is --> ";
    print_r($json_response); echo "\n";
    exit(-1);
  }

  $response = json_decode($json_response, true);
  $envelopeId = $response["envelopeId"];
  curl_close($curl);

  //--- display results
 // echo "Envelope created! Envelope ID: " . $envelopeId . "\n"; 

  /////////////////////////////////////////////////////////////////////////////////////////////////
  // STEP 3 - Get the Embedded Sending View (aka the "tag-and-send" view)
  /////////////////////////////////////////////////////////////////////////////////////////////////
  /*$data = array("returnUrl" => "http://www.docusign.com/devcenter");*/
  $returnUrl = $SITE_URL . "/docusign_return.php";
  $data = array("returnUrl" => $returnUrl);                                                                    
  $data_string = json_encode($data);                                                                                   
  $curl = curl_init($baseUrl . "/envelopes/$envelopeId/views/sender" );
  curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
  curl_setopt($curl, CURLOPT_POST, true);
  curl_setopt($curl, CURLOPT_POSTFIELDS, $data_string);                                                                  
  curl_setopt($curl, CURLOPT_HTTPHEADER, array(                                                                          
    'Content-Type: application/json',                                                                                
    'Content-Length: ' . strlen($data_string),
    "X-DocuSign-Authentication: $header" )                                                                       
  );

  $json_response = curl_exec($curl);
  $response = json_decode($json_response, true);
  $status = curl_getinfo($curl, CURLINFO_HTTP_CODE);
  if ( $status != 201 ) {
    echo "error calling webservice, status is:" . $status . "\nerror text is --> ";
    print_r($json_response); echo "\n";
    exit(-1);
  }

  $url = urlencode($response["url"]);