Sending Email Attachments
Example
- Attaching a product distributor list to an email request form.
MGI Tags
- mgiSendMail
- mgiFieldContent
Steps
- Create a request form and thank you page to process the request form.
- Open the thank you page in a text editor.
- Embed an mgiFieldContent tag and insert the attachmentFileLocation
parameter in the mgiSendMail tag.
- Save the thank you page.
- FTP the thank you page to the web server running MGI.
- Complete and submit the request form.
Step 1: Create a request form and thank you page.
- Create a request form and thank you page to process the request and
send an email. See the Beginner
"Processing Forms to Email" Tutorial for the steps to create
a form and thank you page.
Step 2: Open the thank you page in a text editor.
- Open the thank you page in a text editing program that allows you to
modify the HTML of the page.
Step 3: Embed an mgiFieldContent tag and insert the attachmentFileLocation
parameter in the mgiSendMail tag.
- Embed the visitor's email address in the "to" address of
the email. Remove the quotation marks and value from the "to"
parameter in the mgiSendMail tag and embed an mgiFieldContent tag. To embed
the mgiFieldContent tag, insert your cursor after the equal sign following
the "to" parameter in mgiSendMail and enter an opening brace
({ - the squiggly ones), an mgiFieldContent tag, name parameter, defaultValue
parameter, and closing brace (}). In the name parameter, enter the name
of the form field that contains the visitor's email address. In the defaultValue
parameter, enter a default email address that is used when the visitor
does not enter an email address.
-
- To attach the distributor list with the email, insert the attachmentFileLocation
parameter in the mgiSendMail tag. In the attachmentFileLocation parameter,
enter the the relative path to the email attachment file (at or below the
current level of the file structure). Multiple files may be attached to
an email by separating each file name with a comma. All attachments are
Base64 encoded.
<mgiSendMail from="sales@domain.com"
to={mgiFieldContent name="email" defaultValue="webmaster@domain.com"}
subject="Distributor Request" mailserver="mail.domain.com"
attachmentFileLocation="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 thank you page.
- Save the changes you have made to the thank you page.
Step 5: FTP the thank you page to the web server running MGI.
- Upload the thank you page from your local computer to the web server
using an FTP program.
Step 6: Complete and submit the form.
- Access the request form in a browser. Complete and submit the form.
Upon submission, an email with the "distributor.doc" attachment
is sent.
|