Sending Email Attachments

Introduction

The mgiSendMail tag can attach files from the server to an email. The mgiSendMail tag cannot directly attach files from your local computer to an email, however you could upload the file as part of a form submission via MGI's HTTP upload function and dynamically embed the file name as the attachment.

You may attach multiple files to an email by including multiple "attachmentData" or "attachmentFileLocation" parameters in the mgiSendMail tag.

This example illustrates attaching a product distributor list to a customer request.

MGI Tags

Steps

  1. Create a request form and processing page.
  2. Open the processing page in a text editor.
  3. Enter the attachmentFileLocation parameter in the mgiSendMail tag.
  4. Save the processing page.
  5. FTP the request form and processing page to the web server running MGI.
  6. Complete and submit the request form.


Step 1: Create a request form and processing page.

Create a customer request form and processing page. On the processing page, enter an mgiSendMail tag to format and send the request email. For instructions regarding the construction of a form and email to process the form, please review the Processing Forms to Email tutorial.

Step 2: Open the processing page in a text editor.

Open the processing page in a text editing program that allows you to modify the HTML and code of the page.

Step 3: Enter the attachmentFileLocation parameter in the mgiSendMail tag.

To attach a file to an email, enter the attachmentFileLocation parameter in the mgiSendMail tag. In the attachmentFileLocation parameter, enter the relative path to the file to attach. Multiple files may be attached by including multiple attachmentFileLocation parameters in one mgiSendMail tag. All attachments are Base64 encoded.
<mgiSendMail to={mgiPostArgument name="email"} 
from="sales@domain.com"
subject="Distributor Request" 
mailserver="mail.domain.com"
attachmentFileLocation="Docs/distributor.doc">
Thank you for requesting our distributor list.  
The distributor list is attached to this email.  
If you have any questions, please contact us.
</mgiSendMail>

Step 4: Save the processing page.

Save the changes you have made to the processing page.

Step 5: FTP the request form and processing page to the web server running MGI.

Upload the request form and processing page from your local computer to the web server using an FTP program.

Step 6: Complete and submit the request form.

Access the request form in a browser. Complete and submit the form. Upon submission, an email with the "distributor.doc" attachment is sent.


[Return to the Forms Submission Menu]


[Understanding MGI Menu] [Using MGI Menu] [Referencing MGI Menu]


[MGI Guides Main Menu] [User Guide Main Menu]