The Personalized Attachment feature must first be activated by customer support.
Personalized Attachments enable you to send individual attachments to particular recipients in Optimizely Campaign. Before sending, these attachments must be transmitted to Optimizely Campaign using the HTTP-API. The uploaded attachments can be used when sending transactional mails.
## Usage and functionality
Using Personalized Attachments you can, for example, easily and automatically send invoices and orders to your recipients. You can transmit these files (PDF, text file or another file format) to Optimizely Campaign using the [uploadpersonalizedattachments](🔗) operation. When calling this operation, it is possible to upload one or more attachments using an HTTP request. Therefore, the content of the POST requests consists of a multi-part message of the content type **multipart/form-data**. A correct header of the request can be structured as follows:
Additionally, the attribute boundary is defined here. It is used to separate the content of the individual files in the post request from each other.
The content of the POST request to upload two files looks as follows (abstract):
The attribute filename defines the file name of the attachment. This file name is used when sending the mailing. This way, you can transmit recipient-related file names, such as _Invoice\_John\_Smith.pdf_. If the attachment was successfully uploaded, a token is returned:
To use the uploaded attachments in transactional mails, you have to transmit the above mentioned token when calling the [sendtransactionmail](🔗) operation. Such a call might look like this:
In this example, the recipient receives the content of the mailing and the attachments referenced by the token.
## Further examples
Below are examples of using the personalized attachment. The <auth\_code> placeholder used in these examples must be replaced with the actual authorization code.
In the following example, the file _Your\_Order.pdf_ is uploaded and sent to the recipient with the email address "j[email protected]". This example uses some Apache HHTTP components. You can get the required libraries from [http://hc.apache.org](🔗).
The following shell script _upload\_attachment\_and\_send\_to\_recipient.sh_ uploads an attachment using CURL and sends it in a transaction email:
To invoke the above mentioned file, the following command must be invoked:
### PHP (Version 5.3.5)
In the following example, the file _Your\_Order.pdf_ is uploaded and sent to the recipient with the email address "[email protected]".