我正在尝试通过 API 发送电子邮件,但它给了我所有电子邮件地址的错误,因为“收件人的电子邮件地址无效。收件人 ID 如下”。提前致谢
尝试通过 API 做几件事。
- 手动将我们现有的所有模板上传到文档(dpd 格式的模板大约有 10 个)。
在我们的服务器中创建一个文档。
通过 API 创建信封。
- 将创建的文档应用到文档中的正确模板。(我正在尝试这样做 - 附加代码)
寄信封。(我这里有错误)
将签名的文档下载回服务器。- (这个完成了。)
.
public void ApplyToTemplate()
{
//// Create the recipient information
//recipient1
DocuSignWeb.Recipient recipient1 = new DocuSignWeb.Recipient();
recipient1.UserName = "Client";
recipient1.Email = "XXXX@gmail.com";
recipient1.Type = DocuSignWeb.RecipientTypeCode.Signer;
recipient1.RequireIDLookup = false;
recipient1.RequireIDLookupSpecified = true;
recipient1.RoutingOrder = 1;
recipient1.RoutingOrderSpecified = true;
recipient1.RoleName = "Client";
recipient1.ID = "1";
DocuSignWeb.Recipient[] recipients = new DocuSignWeb.Recipient[] { recipient1 };
// Create the template reference from a server-side template ID
DocuSignWeb.TemplateReference templateReference = new DocuSignWeb.TemplateReference();
templateReference.Template = "XXXX";
templateReference.TemplateLocation = DocuSignWeb.TemplateLocationCode.Server;
//templateReference.Document = new DocuSignWeb.Document();
//templateReference.Document.PDFBytes = ConvertWordToPdfByte(@"c:\temp\a.doc");
// Construct the envelope information
DocuSignWeb.EnvelopeInformation envelopeInfo = new DocuSignWeb.EnvelopeInformation();
envelopeInfo.AccountId = "XXXXX";
envelopeInfo.Subject = "hello from API";
envelopeInfo.EmailBlurb = "hello";
// Create draft with all the template information
DocuSignWeb.EnvelopeStatus status = _apiClient.CreateEnvelopeFromTemplates(new DocuSignWeb.TemplateReference[] { templateReference }, recipients, envelopeInfo, false);
DocuSignWeb.EnvelopeStatus sendStatus = _apiClient.SendEnvelope(status.EnvelopeID, envelopeInfo.AccountId);
}