You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在HelloSign(PHP)中分别设置邮件主题与邮件内文档名称

How to Separate Email Subject and Document Title in HelloSign Template Requests (PHP)

Got it, let's break this down. That default behavior where setSubject() controls both the email subject and the document title under the DOCUMENT heading in the email body is definitely a gotcha—but there's a straightforward fix using HelloSign's PHP SDK.

Here's what you need to do:

HelloSign lets you explicitly set the document title separately from the email subject. You just need to use the right method in your signature request:

  • Set the email subject as usual with setSubject():
    $request->setSubject('Your Official Contract Review Request');
    
  • Set the custom document title (the one that shows up under DOCUMENT in the email body) using setDocumentTitle():
    $request->setDocumentTitle('Q3 2024 Vendor Service Agreement');
    

Full Example Code

Here's how this fits into a complete template-based signature request:

// Initialize the HelloSign client
$client = new HelloSign\Client('YOUR_API_KEY');

// Create a template signature request
$request = new HelloSign\SignatureRequestTemplate();

// Set email subject (only for the email's subject line)
$request->setSubject('Action Required: Sign Your Q3 Service Contract');

// Set custom document title (shows under DOCUMENT in email body)
$request->setDocumentTitle('Q3 2024 Vendor Service Agreement');

// Add your template ID and signer details
$request->setTemplateId('YOUR_STORED_TEMPLATE_ID');
$request->addSigner('john.doe@example.com', 'John Doe');

// Send the request
try {
    $response = $client->sendSignatureRequest($request);
    echo "Signature request sent successfully!";
} catch (HelloSign\Exception\ApiException $e) {
    echo "Error: " . $e->getMessage();
}

What if setDocumentTitle() isn't available?

If you're using an older version of the HelloSign PHP SDK that doesn't have the setDocumentTitle() method, you can manually add the parameter using addExtraParam():

$request->addExtraParam('document_title', 'Q3 2024 Vendor Service Agreement');

Why this works

By default, HelloSign falls back to using the email subject as the document title if no explicit document_title is provided. By setting this parameter explicitly, you override that default behavior and get separate values for the email subject and the document title in the email body.

内容的提问来源于stack exchange,提问作者Teshan N.

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.25 06:33:45