Home > Enterprise >  How to send a file attached to the signature request email
How to send a file attached to the signature request email

Time:02-01

I'm using the PHP SDK to integrate DocuSign eSign REST API into a Laravel application. We have been asked to attach a couple of PDF files to every signature request email, but I don't know if this is even possible.

I thought that the EnvelopeAttachments resource would be a way to go, but signers do not receive any attachment so far and here it is said that such attachments are not visible for them.

Here there is the SDK code I am using:

$attachments = [
            new Attachment([
                'access_control' => 'sender',
                'attachment_id' => '1',
                'attachment_type' => '.pdf',
                'data' => base64_encode($this->getPdf($document, $signers)),
                'label' => 'attachment 1',
                'name' => 'attachment 1',
                'remote_url' => 'attachment 1',
            ]),
        ];
        $envelope_definition = new EnvelopeDefinition([
            'composite_templates' => $composite_templates,
            'email_subject' => "Firmar $documentTypeSp",
            // 'email_blurb' => "Se solicita su firma para el contrato $document->name",
            'status' => "sent",
            'attachments' => $attachments,
        ]);
        $envelope_definition->setEnvelopeAttachments($attachments);
        return $envelope_definition;

CodePudding user response:

You cannot attach a file to this email that is auto-generated by the system. The envelope attachment shows in the envelope, it is not attached to the email.

While I don't recommend it, your only option is to send emails yourself, with links going to your own webserver, where you generate embedded signing URLs on the fly and redirect the users.

I would suggest you consider an alternative to having the attachment in the email. Like having a link in the email that goes to some sort of cloud storage or to your own server.

CodePudding user response:

The EnvelopeAttachments resource is used to attach a document to an envelope. According to the API documentation, attachments are not visible to signers. So, it appears that it is not possible to attach a file to the signature request email.

One alternative approach to include the PDF files in the email body is to embed them as inline images. You can convert the PDF to an image format, such as PNG or JPG, and then embed the image into the HTML email body using the <img> tag. The recipient can then view the PDF document directly in the email.

  • Related