Create a form for your visitors to send information to you through email
This section will show you how to send the contents of a form to a specified email account. Please note that this does not support upload field of a form. Your web hosting has to support PHP 5 or above and sending email using PHP mail() function. The PHP extension mbstring also needs to be installed on your server. You may need to check this out with your web hosting or just create a form like the one below to test whether this function is supported on your web server. (Video Tutorial - 6:33)
Please note that field name must begin with a letter (A-Z, a-z) and may be followed by letters, digits (0-9), or underscores ("_").
We will create a form first with just two fields, one for the name and the other for the email address.
Open or create a web page.
Select Insert -> Form and Form Elements -> Form or click on this button to create a new form.
Select the newly created form. Then select Insert -> Form and Form Elements -> Form Text from the main menu. A text box will be added to the form as shown below. The outer box is for the convenient of putting form controls within it. It will not be shown when the page is generated.
Double click the text box and fill in the values as shown on the image below. Click OK to save the settings.
Select the form again then repeat step 2 to add another text box to the form.
Double click the text box and fill in the values as shown on the image below. Click OK to save the settings.
Select the form again. Then select Insert -> Form and Form Elements -> Button from the main menu.
Double click the newly added button and fill in the values as shown on the image below. Click OK to save the settings.
Arrange the positions of the added form controls.
Select the form on the page again. Then select Insert -> Send Form to Email Using PHP from the main menu. The following dialog will be shown. The fields of the form are already added to the dialog.
Change the mandatory of these two fields to "Yes" so that if any one of the field is left blank, the contents of the form will not be sent but an error message will be returned. For the email field, change the value of "Is Email?" to "Yes". Extra validation will be done to check whether it looks like a valid email address.
Click on "Email Settings" tab. The "From:" field of the email will be filled with the email field of the form. If your form does not have any email address. Enter a suitable email address which will be shown on the "From:" field within the email sent to you. Please note that some web hosting companies do not allow using free email account in the "From email". So, you may need to deselect the option "Use email from form" and enter an email acceptable to your hosting providers. Enter your receiving email for the contents of this form at the "To email" text box. Give the email a subject and enter it to the text box.
Click on the "Validation Messages" tab. Some default messages are already filled. You can change them to fit your needs.
The first message will be returned if the form fields that have been marked mandatory are left empty. The second message will be returned if the strings "Content-Type", "Cc:" or "Bcc:" are found. These are email headers that attackers inject into a PHP script through a form attempting to turn online forms into spam relays. The third message will be returned if the format of the email address is incorrect.
Click on the "Completion Action" tab. Enter the success or failure messages that will be sent to show whether the sending of email is successful. You can instead choose to redirect to a success or failure page instead of showing a message.
Click on the "Styles" tab. Here you can select the CSS styles used for each message. For example, we want all validation and error messages to be shown in red and in bold font. We can define a style. Let's name it "error-message". It is defined within the CSS Style Editor and has the following settings:
We can then assign this style to the messages as shown below.
If there are validation or error messages, they will be shown on the page with this style.
Click OK to continue. The following information message will be shown if the page adding this does not have a PHP extension.
Click OK to change the extension of the page to PHP.
The following box will be added to the page. The validation, success and error messages if any will be shown within this box using the chosen CSS style.
Resize the box large enough for the messages and place it at an appropriate position. For example, it can be placed above the form.
To remove this function from the form, delete the PHP box. You also need to change the extension of this page from ".php" to ".html" manually.
The contents of the email will look like this:
customername: somebody
email: name@somedomain.com
You can add a Honeypot Captcha to the form to block spambots from sending you spam emails. Just select the option "Use Honeypot Captcha" on the Honeypot Captcha tab.