Docusign SDK C# Resend envelope with different email body and subject

51 views Asked by At

I am using the following code to resend an envelope (to the same email address as the previous) for which I want to update the email body and/or subject.

            var prevSigner = envelopesApi.ListRecipients(account_id, docusigncriteria.envelope_id).Signers[0];
            Signer signer1 = new Signer
            {
                Email = docusigncriteria.signerEmail,
                Name = docusigncriteria.signerName,
                RecipientId = prevSigner.RecipientId,
                RoutingOrder = "1",
                ClientUserId = docusigncriteria.signerName,
                EmbeddedRecipientStartURL = "SIGN_AT_DOCUSIGN",
                EmailNotification = new RecipientEmailNotification
                {
                    EmailSubject = "Custom email subject for signer 1",
                    EmailBody = "Custom email body for signer 1"
                }
            };

            List<CarbonCopy> ccList = new List<CarbonCopy>();
            for (int i = 0; i < docusigncriteria.ccEmails.Length; i++)
            {
                ccList.Add(new CarbonCopy
                {
                    Email = docusigncriteria.ccEmails[i],
                    Name = docusigncriteria.ccNames[i] ?? "To Whom it May Concern",
                    RecipientId = Guid.NewGuid().ToString(),
                    RoutingOrder = "1",
                    DeliveryMethod = "email",
                    EmailNotification = new RecipientEmailNotification
                    {
                        EmailSubject = "Custom email subject for signer 1",
                        EmailBody = "Custom email body for signer 1"
                    }
                });
            }
            Recipients rec = new Recipients
            {
                Signers = new List<Signer> { signer1 },
                CarbonCopies = ccList,
            };
            var recSummary = envelopesApi.UpdateRecipients(account_id, docusigncriteria.envelope_id, rec, new EnvelopesApi.UpdateRecipientsOptions() { resendEnvelope = "true" });

However only the CC recipients see the new email body/subject text. The signer receives and email with the original sent email body/subject.

1

There are 1 answers

0
Richard Michels On

Need to call the api Update method with the specified changes. Then, calling the UpdateRecipients method resends the envelope email with the expected changes to email subject and body.

env.EmailSubject = "Updated Email Subject";
env.EmailBlurb = "Here is the updated body of the email.";
envelopesApi.Update(accountId, envelopeId, env);```