Lasso Soft Inc. > Home

  • Articles

Lasso Basics - Email Contact Form - Part 2

The tip of the week for March 23, 2007 shows how to create an email contact form using Lasso. The tip demonstrates a basic technique which is used on many sites. The tip includes instructions for a simple contact form and several variations including sending email to multiple recipients, sending HTML formatted email, and sending attachments with the email.

HTML Formatting

The bare bones formatting which is shown above (in Part 1) is sufficient for a simple contact form which you are going to receive. However, if you are creating a contact form for a client you might want to create a prettier format for them.

A working example of this form can be found in the download in the "html_format.lasso" file. You should replace the email address "example@example.com" with your own email address to test the form.

This example uses exactly the same form as the survey shown above. However, in the [Email_Send] tag the -Body parameter has been replaced by an -HTML parameter. The HTML formatting will show up within the client's email client. Note that the image is actually embedded into the email message by including its name in array passed to the -HTMLImages parameter.

  Email_Send: -To='example@example.com',
    -From='example@example.com',
    -Subject='Email Form - ' + (Action_Param: 'topic'),
    -HTML='<img src="LassoSoft_Logo.png" border="0" align="center" />\r\r' +
      '<h2>' + (Action_Param: 'topic') + '</h2>' +
      '<p>The following form was submitted on your Web site:</p>\r\r' +
      '<p>Name:<br />\r<b>' + (Action_Param: 'name') + '</b></p>\r\r' +
      '<p>Email:<br />\r<b>' + (Action_Param: 'email') + '</b></p>\r\r' +
      '<p>Comments:<br />\r<b>' + (Action_Param: 'comments') + '</b></p>\r\r' +
      '<p>How Long:<br />\r<b>' + (Action_Param: 'howlong') + '</b></p>\r\r' +
      '<p>Platform:<br />\r<b>' + (Action_Param: 'platform') + '</b></p>\r\r' +
      '<p>Date/Time:<br />\r<b>' + Date + '</b></p>\r\r' +
      '<p>Client:<br />\r<b>' + Client_IP + ' ' + Client_Type + '</b></p>\r\r',
    -HTMLImages=(Array: 'LassoSoft_Logo.png');

 

It would also be possible to use an absolute URL to reference an image stored on your Web server (e.g. http://www.lassosoft.com/_images/LassoSoft_Logo.png). If you want to support both plain text and HTML email clients you can include both a -Body parameter with a plain text version of the message and an -HTML parameter with a formatted HTML version of the message.

An example of the message as it is received by the client is shown here.

 

[b]General Feedback[/b]
The following form was submitted on your Web site:
Name:  [b]Fletcher[/b]

Email: [b]fletcher@lassosoft.com[/b]

Comments: [b]This is a great Web form.[/b]

How Long: [b]2 years[/b]

Platform: [b]Macintosh Windows Linux [/b]

Date/Time: [b]03/23/2007 20:45:26[/b]

Client: [b]127.0.0.1 Mozilla/5.0 AppleWebKit/419 Safari/419.3[/b]

Author: Fletcher Sandbeck
Created: 23 Mar 2007
Last Modified: 16 Mar 2011

<-Email Contact Form Pt 1               Email Contact Form Pt 3 - Email Attachment ->

Please note that periodically LassoSoft will go through the notes and may incorporate information from them into the documentation. Any submission here gives LassoSoft a non-exclusive license and will be made available in various formats to the Lasso community.

LassoSoft Inc. > Home

 

 

©LassoSoft Inc 2015 | Web Development by Treefrog Inc | PrivacyLegal terms and Shipping | Contact LassoSoft