DocuSign attaching a document to an envelope - soap

I was wondering if it was possible to attach a document or documents to an envelope when sending envelopes via SOAP API? I have used the api to create an Attachment object and added the bytes but when I attach to the envelope the status envelope attachments comes back as null and when I look at the docusign email there is no attachment( I'm assuming is due to the fact that attachment returns as null in the status, but when I debug it the attachment is clearly there. Can a sender attach documents to an envelope?
Attachment attachment = new Attachment(){
Data = "bytes",
Label = "name",
Type = "Document"
};
newTemplate.Envelope.EnvelopeAttachment = new Attachment[] { attachment };
Finally I attach the attachment to the envelope and send.
Thank you

The EnvelopeAttachment property of the Envelope object in the SOAP API merely exists as a way for an integrated application to "pass along" another file with an Envelope during the Create Envelope process, such that this file will be associated with the Envelope from that point forward and the integrated application can access it in the future via API if necessary. Files supplied in this manner (i.e., using the EnvelopeAttachment property) will never be visible within the DocuSign UI, or to the recipients of the Envelope in the Envelope itself -- the only way to access them is via the API.
If you merely need to add another file to the Envelope that all recipients will see in the Envelope but that no recipients are required to sign, etc., then you should add that file to the Envelope in the same way that you add all other files to the Envelope (i.e., using Documents property of the Envelope object) and just don't specify any Tabs for that document.

Related

change recipient / attach a file to a sent email in outlook

I've been trying to test something out, basically looking to do one of the following things:
Change name of recipient in a sent file. I've tried using Outlook Spy (great tool) but every time I changed the recipient in PR_DISPLAY_TO_W it returned the following error:
Could not edit the property: HrSetOneProp returned MAPL_E_COMPUTED
Attaching a file to a sent email file. (I don't know if this one is possible, but would be useful if it was.)
I appreciate any responses.
PR_DISPLAY_TO / CC / BCC are computed properties. The store provider updates them whenever recipients list is modified.
Use the MailItem.Recipients collection to modify the recipients.
MailItem.Attachments.Add.

How to get the ItemId of save-to-sent copy when sending mail via EWS

The EWS documentation says that to send a message and save a copy to the Sent Items folder, you should use the CreateItem operation with a MessageDisposition value of SendAndSaveCopy.
<m:CreateItem MessageDisposition="SendAndSaveCopy">
<m:SavedItemFolderId>
<t:DistinguishedFolderId Id="sentitems" />
</m:SavedItemFolderId>
<m:Items>
<t:Message>
<t:Subject>Company Soccer Team</t:Subject>
<t:Body BodyType="HTML">Are you interested in joining?</t:Body>
<t:ToRecipients>
<t:Mailbox>
<t:EmailAddress>sadie#contoso.com </t:EmailAddress>
</t:Mailbox>
</t:ToRecipients>
</t:Message>
</m:Items>
</m:CreateItem>
On success, "the server responds to the CreateItem request with a CreateItemResponse message that includes a ResponseCode value of NoError, which indicates that the email was created successfully, and the ItemId of the newly created message."
Using EWS against Office 365, this works almost successfully. The message is sent, the copy is saved to Sent Items... but the ItemId of the saved copy is not returned in the response:
<m:CreateItemResponse>
<m:ResponseMessages>
<m:CreateItemResponseMessage ResponseClass="Success">
<m:ResponseCode>NoError</m:ResponseCode>
<m:Items />
</m:CreateItemResponseMessage>
</m:ResponseMessages>
</m:CreateItemResponse>
Is there a way to direct the EWS server to actually return the ItemId of the saved copy? Alternatively, what's the preferred mechanism for locating the saved copy once the send completes?
Evidently the documentation is either wrong or inapplicable. This MSDN blog post matches my experience: no ItemId is returned from a SendAndSaveCopy CreateItem request. It suggests the following:
Simply stamp your e-mail message with a custom extended property when you create the message, and then use that extended property to find the message in the Sent Items folder after it has been sent.
A commenter suggests that rather than using an expensive FindItems-with-SearchFilter call to locate the custom-property-stamped saved copy, you should instead do the following:
1. Set your extended prop.
2. Do a FindItem with NO restriction against the sent items folder, SORTED by creation date descending with a indexed page view of about 5. Include your extended prop in the PropertySet.
3. Iterate across the results looking for your extended prop.

How to send an email with IBM Message Broker?

As a part of overall project, I need to create one Message-Broker application which accepts data in XML format and produce email.
I created one message flow like below
"MQ Input - Compute - emailoutput"
Please help me what should I write in xml file to generate the above flow.
The esql file contain the below code:
CREATE FUNCTION Main() RETURNS BOOLEAN
BEGIN
CALL CopyMessageHeaders();
-- Add recipient information to the EmailOutputHeader
SET OutputRoot.EmailOutputHeader.To = '<recipient email address>';
SET OutputRoot.EmailOutputHeader.Cc = '<recipient email address>';
SET OutputRoot.EmailOutputHeader.Bcc = '<recipient email address>';
-- Add sender information to EmailOutputHeader
SET OutputRoot.EmailOutputHeader.From = '<sender email address>';
SET OutputRoot.EmailOutputHeader."Reply-To" = '<reply email address>';
-- Add subject to EmailOutputHeader
SET OutputRoot.EmailOutputHeader.Subject = 'Replaced by ESQL compute node.';
-- Add SMTP server information to the LocalEnvironment
SET OutputLocalEnvironment.Destination.Email.SMTPServer ='<smtp.server:port>';
-- Create a new message body, which will be sent as the main text of the email.
SET OutputRoot.BLOB.BLOB = CAST('This is the new text for the body of the email.' AS BLOB CCSID 1208);
RETURN TRUE;
END;
I have absolutely no idea what xml file you're talking about.
Lay out msg flow in the message broker toolkit, by adding and connecting the three nodes you specified. Then add your code to the Compute Node.
You can pass values Using XPATH, by using InputRoot.XMLNC , using Environment or LocalEnvironment.
If we take your requirements ,
that Seems The Message come from your MQInput node you are using XMLNSC Parser.
-- Add recipient information to the EmailOutputHeader
SET OutputRoot.EmailOutputHeader.To = InputRoot.XMLNSC.EmailData.To;
-- Add sender information to EmailOutputHeader
SET OutputRoot.EmailOutputHeader.From = InputRoot.XMLNSC.EmailData.From;
-- Add subject to EmailOutputHeader
SET OutputRoot.EmailOutputHeader.Subject = InputRoot.XMLNSC.EmailData.Subject;
-- Add SMTP server information to the LocalEnvironment
-- You can Add Smtp Server From Configuration in Your Broker Administration side as Configurable Service
SET OutputLocalEnvironment.Destination.Email.SMTPServer ='<smtp.server:port>';
-- Create a new message body, which will be sent as the main text of the email.
SET OutputRoot.BLOB.BLOB = CAST(InputRoot.EmailData.Body AS BLOB CCSID 1208);
For Testing , In Test Client Type this XML File
<EmailData>
<To>recieverEmail#example.com</To>
<From>fooSenderEmail#example.com</From>
<Subject>Testing Email App</Subject>
<Body><![CDATA[<h1>Testing Email Data</h1><br/><hr /><br/><h6>Testing Email</h6></hr />]]></Body>
</EmailData>

how to notice if a mail is a forwarded mail?

I have a very special problem.
If we create a mail in Outlook, we add a UserProperty which contains a DataBase-ID of our System, so we can Link the mail to the representing DataBase-Item. On the service which reads the mails in each Mailbox and imports them automatically I can read this property by using ExtendedPropertyDefinitions. So far everything is fine...
If the User now forwards the message in Outlook, Olk copies the UserProperty to the new message. And now my problems beginn. Now my Service thinks the new message is also linked to our database and updates DB-Entry with the new Body and new Subject.
So does anyone now how to find out if a message is a forwarded one or how to tell Outlook not to copy the userproperty to the forwarded (new) message?
thx. Jay
What we thought about, but isnt working for our case
- a second userproperty containing a simple tag linke "fromSystem". Cause this would be copied too.
- a second userproperty containing a hashsum calculated from subject and Body. Cause both could be changed by the user. We just create the message, add all properties and Display it. from this Point on we no longer have control what is Happening to the mail until the Service handles it.
Your service consuming EWS should check the ConversationIndex and only update the database if it's 22 bytes long (original source message). Forward emails and reply emails keep appending 5 bytes (10 chars) to the ConversationIndex extending it beyond 22 bytes.
Sample ConversationIndexes
Original: 01CDD15D80E51C1D4522172840ACA96287DA28A15D97
Reply: 01CDD15D80E51C1D4522172840ACA96287DA28A15D970000018630
Forward: 01CDD15D80E51C1D4522172840ACA96287DA28A15D970000018630000000FC30
ConversationIndex represents the sequential ordering of the ConversationTopic (essentially GUID + timestamp). See Working with Conversations on MSDN. ConversationIndex is explicitly defined on MSDN here.
if (message.ConversationIndex.Length == 22)
{
// update DB body, subject, etc.
}
Also make sure you load the EmailMessageSchema.ConversationIndex before trying to access its value.

Sending email with attachment

I've a custom form (created with form API) that need send an uploaded file by email. The current form submit handler sends the email without attachment using drupal_mail().
So I'm looking for a solution to properly send email with attachment from Drupal. Mime Mail seems an overkill because HTML mail, templating and its other features are not required. But the only other alternative I see is to set the appropriate headers and serialize the attached file in the mail body when processing the mail in my hook_mail() implementation.
Did I miss anything? Is there any module to handle this?
Mimemail is the easiest solution here. Be it an overkill or not, it will allow you to get it done with a single function call.
If you insist, you may have your homemade attachment sender: base64 encode your attachment(s), add them to the mail body, add the correct headers and you're done.
You can use mime mail and force the message body to be sent in plaintext format. Here is an excerpt from the module's readme file:
USAGE
This module may be required by other modules, but is not terribly
useful by itself. Once installed, any module can send messages by
calling the mimemail() function:
$sender - a user object, text email address or an array with name, mail
$recipient - a user object, text email address or an array with name, mail
$subject - subject line
$body - body text in HTML format
$plaintext - boolean, whether to send messages in plaintext-only (default FALSE)
$headers - a keyed array with headers (optional)
$text - plaintext portion of a multipart e-mail (optional)
$attachments - array of arrays with the file's path, MIME type (optional)
$mailkey - message identifier
return - an array containing the MIME encoded message
The key thing being to set the $plaintext argument to TRUE. Now you can have your cake and eat it too.
You could always have a look at the Swift Mailer module which lets you send HTML (MIME) e-mails, e-mails with inline images and e-mails with attachments. It is also cabable of automatically generating plain text versions based on the HTML e-mail version, which in the end will let the user's e-mail client display the preferred version (HTML or plain text).
The Swift Mailer module is available on http://drupal.org/project/swiftmailer.
For the record : I'm the author and maintainer of the module.
The Webform module allows you to create a form and has a file option which can be used as an attachment. All available form components are listed on the module's manual page.
Once installed Webform will appear as a content type. Once you have saved the fundamentals, such as the title and the email to address, you will have the ability to add the required form components.
Add a component of type 'file', ensuring the 'email' (to recipient) option is ticked, and you will then be able to customize the permitted file types, extensions, sizes and upload folder.
You could use the Zend Framework.
function sendEmail($params){
ini_set('include_path', 'inc/');
require_once ('inc/Zend/Mail.php');
$mail = new Zend_Mail();
$mail->setSubject( $params['subject'] );
$mail->setBodyText( $params['bodyText'] );
$mail->setBodyHtml( $params['bodyHtml'] );
$mail->setFrom( $params['fromEmail'], $params['fromName'] );
$mail->addTo( $params['toEmail'], $params['toName'] );
// Finally, add an attachment
assert( file_exists($params['attachFile']) );
$at = $mail->addAttachment(file_get_contents($params['attachFile']));
$at->type = $params['attachType'];
$at->disposition = Zend_Mime::DISPOSITION_ATTACHMENT;
$at->filename = $params['attachName'];
$mail->send();
}