--- title: "How Do I Add Attachments to an Email? - Lasernet Developer" slug: "how-do-i-add-attachments-to-an-email" description: "This article provides a solution for including additional attachments in an email. A document generated by Lasernet can be emailed via the Mail Output Port." tags: ["Lasernet Developer", "Emails", "Attachments"] updated: 2024-06-21T08:54:28Z published: 2024-06-21T08:54:28Z canonical: "kb.lasernetgroup.com/how-do-i-add-attachments-to-an-email" --- > ## Documentation Index > Fetch the complete documentation index at: https://kb.lasernetgroup.com/llms.txt > Use this file to discover all available pages before exploring further. # How Do I Add Attachments to an Email? This article provides a solution for how to include additional attachments in an email. A standard document generated by Lasernet (stored in **JobData**) can be emailed via the **Mail Output Port**. Also, additional documents can be stored as extra attachments to the standard document (**JobData**). Both **JobData** and mail attachments can contain any text or binary format, such as XML, PDF, Word, etc. Users can retrieve attachments via file access in **JavaScript**, the **Database** module, or the **File Retriever** module (file, FTP, or HTTP) and insert them as mail attachments via the required **JobInfos**. A list of **JobInfos** must be defined for the **Mail Output** module. The first attached file in the email will by default contain the **JobData**. The remaining files' attachments will contain what has been included in the **MailAttachment JobInfos**. | JobInfo | Description | Example | | --- | --- | --- | | MailAttachment[index] | Binary Data | [Binary] | | MailAttachmentFilename[index] | Name of file | test.PDF, test.doc | | MailAttachmentMimetype[index] | Mimetype for file content | application/pdf, application/msword | #### Example In the following example, the data file contains references to two extra attachments that we want to pick up during the process and attach to the email as well. Follow these steps: 1. Create a data file with reference to the name of the attachments; in this case, only the first part of the filename can be the full name. ![](https://cdn.document360.io/c831ef63-c6b3-48ee-b443-3e33644e4e2e/Images/Documentation/image-4L02HGST.png) 1. Open the files folder with the files to pick up. ![](https://cdn.document360.io/c831ef63-c6b3-48ee-b443-3e33644e4e2e/Images/Documentation/1645095993322.png) 1. Open the **File Retriever** modifier, name it **GetFiles**, and then click the **Setup** tab. 2. Ensure the **Replace JobInfo** checkbox is cleared to make an array. ![](https://cdn.document360.io/c831ef63-c6b3-48ee-b443-3e33644e4e2e/Images/Documentation/1645097379667.png) 1. Open the **Script** tool and configure the script to read the first part of the name from the data. 2. Run and fetch the **FileRetriever** and set the names of the files in a **JobInfo** array of **MailAttachmentFileNames**. ![](https://cdn.document360.io/c831ef63-c6b3-48ee-b443-3e33644e4e2e/Images/Documentation/1645097867195.png) 1. Configure the Form to run the script, thereby picking up the attachments. 2. Create a Pattern for the attachments and a Rearrange on the data field with the name on it to run the script. ![](https://cdn.document360.io/c831ef63-c6b3-48ee-b443-3e33644e4e2e/Images/Documentation/1645098261217.png) ![](https://cdn.document360.io/c831ef63-c6b3-48ee-b443-3e33644e4e2e/Images/Documentation/1645098515297.png) 1. At this stage, you can test the fetching of files from the Developer. To view the files being picked up, click **View** in the menu bar and select the **Logger** checkbox. ![](https://cdn.document360.io/c831ef63-c6b3-48ee-b443-3e33644e4e2e/Images/Documentation/1645104014941.png) 1. Ensure your standard data output has set the **JobInfo Filename**. This could have been set dynamically. Consider having a proper **MailRecipient** set in **JobInfo MailTo** (can be set on any module or form). In the attached test setup, you will need to configure **Mail Output Port** to your settings. [](https://cdn.document360.io/c831ef63-c6b3-48ee-b443-3e33644e4e2e/Images/Documentation/Mail-with-extra-attachments.lnconfigx)Mail-with-extra-attachments55.91 KB[](https://cdn.document360.io/c831ef63-c6b3-48ee-b443-3e33644e4e2e/Images/Documentation/Mail-with-extra-attachments.lnconfigx)