AttachToEmail – XpressDox

Use «AttachToEmail()» in conjunction with the «SaveAsEmail()» or «SendAsEmail()» functions. There are various implementations for this function.

 

Scenario 1:

Save the current template as an email, and attach another document to the resulting email. Hard code the name of the file to be attached.


Dear «Name»
Please find attached the document.
«SaveAsEmail(EmailAdd,'Attached documentation')»
«AttachToEmail(‘Test Doc.docx’)»

Scenario 2:

Save the current template as an email, and attach another document but that document name is not hard coded. Sample code for that might be something like this:


Dear «Name»
Please find attached the document.
«SaveAsEmail(EmailAdd,'Attached documentation')»
«AttachToEmail(concat('.\Documents\Agreements\Letter to ',Client_Name))»

 

Scenario 3:

Save the current template as an email. Use MergeTemplate or RunTemplate to assemble separate document (or documents) and attach that assembled document to the email. Sample code for that might be something like this:


Dear «Name»
Please find attached the document.
«SaveAsEmail(EmailAdd,'Attached documentation')»
«MergeTemplate('Initial Letter')»

«Comment(Place the following function on the 'Initial Letter' template)»
«AttachToEmail()»

Related articles:

SaveAsEmail

SendAsEmail

AddToAddress

AddCCAddress

AddBCCAddress