» PHPMailer for PHP4
» PHPMailer for PHP5/6
» PHPMailer-FE (Form2Email)
» PHPMailer-ML
» PHPMailer-BMH
    Table of Contents
    Link Back

    Link Back:
    Please use our link back image with your form:

    along with the hyperlink:
    <a href="http://sourceforge.net/projects/phpmailer/"><img border="0" src="phpmailer-fe_sm.gif"></a>
    Thank you.
    Copyright

    If you run into any problems while trying to configure this scripts, help is available. The steps you should take to get the fastest results, are:
          1) Read this file thoroughly.
          2) Consult the WorxWare website (phpmailer.worxware.com):

    We also offer a variety of paid support options to help with commercial projects.

    COPYRIGHT:
    Copyright 2007-2008, Andy Prevost. All Rights Reserved.

    PHPMailer-FE is LGPL licensed. You are encouraged to use PHPMailer-FE in your personal projects and commercial projects.

    This program is distributed in the hope that it will be useful - WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

    Overview
    PHPMailer-FE is a Form to Email gateway. Hidden configuration fields can be used to enhance the operation of PHPMailer-FE on your site.
    Setting Up PHPMailer-FE
    PHPMailer-FE does not have to be extensively configured in order to work. There are only a few variables in the script which you will need to define.

     
    $PHPMailerLocation = FEPATH . "class.phpmailer.php";
      If the PHPMailer class is found at the location you define, PHPMailer-FE will use the PHPMailer class to send the email(s). If the PHPMailer class is NOT found, PHP mail() will be used to send the email(s). Note: HTML formatting of sent emails is not available when using PHP mail().
     
    $PHPMailerLiteLocation = FEPATH . "class.phpmailer-lite.php";;
      If the PHPMailer-Lite class is found at the location you define, PHPMailer-FE will use the PHPMailer-Lite class to send the email(s). If the PHPMailer-Lite class is NOT found, PHP mail() will be used to send the email(s). Note: HTML formatting of sent emails is not available when using PHP mail().
     
      $referers = array ('yourdomain.com','10.10.10.10');
      This array allows you to define the domains on which you allow forms to reside and use this installation of PHPMailer-FE. If a user tries to put a form on another server, that is not yourdomain.com, they will receive an error message when someone tries to fill out their form. By placing yourdomain.com in the @referers array, this also allows www.yourdomain.com, ftp.yourdomain.com, any other http address with yourdomain.com in it and yourdomain.com's IP address to access this script as well, so no users will be turned away.

    NOTE: This is not very secure. Referer headers can easily be faked. It prevents someone on notyourdomain.com from using the PHPMailer-FE script on your server to process forms on their server.

     
      $env_report = array ('REMOTE_HOST','REMOTE_ADDR','REMOTE_USER', 'HTTP_USER_AGENT','HTTP_REFERER');
      This array allows you to specify a list of environment variables the user may request to have added into the email.
    Only environment variables listed in this array may be included in the form field env_report.
     
      $banEmails = array ('*@anydomain.com', '*@otherdomain.com');
      This array allows you to specify a list of email addresses that are not permitted to submit forms on your domain. Based on the "email" field. Can be set to wildcards as noted in the example above.
     
      $useWindowClose = false;
      Default value is false. If no redirect has been specified, the default page will display. With $useWindowClose set to true, the default page will close automatically after 5 seconds.
      $fixedFromEmail = '';
      Default value is empty. This feature is used to set the "From:" to a specific email address. If this is left empty, the user's email address (as found in the form data) will be used and if that is empty, it will default to "webmaster@yourdomain.com".
      $fixedFromName = '';
      Default value is empty. This feature works in conjunction with the $fixedFromEmail above. It is meant to be the full name of the individual the form is from.
      $useWorxTuring = false;
      Default value is false. Regardless of whether or not a Turing test input field is in the form (and will be submitted), if this setting is at false, the Turing test will not be processed. Likewise, even if this setting is true, if the form contains no field with the name "WorxTuringTest", no processing will take place.
      $useWindowClose = false;
      Default value is false. If your forms are popups (ie. called from a Javascript as a popup window), you have the option of using a Javascript function to close the window instead of redirecting to another page. If you wish to use the Javascript window.close() method set this option to true.
      $useBanlist = false;
      Default value is false. The Banlog or Ban list is a file that contains both the IP address and Remote Host of a banned user. If you set this option to true, the phpmailer-fe.php will check this list before submitting data or sending an email. If the IP address or Remote Host of the submitter are in this list, the email will not be sent and an error message will be displayed to the user. You also have the option to check the Banlog or Ban list before loading the form, to prevent the user wasting time filling in a form that will not be submitted.
      $fileBanlist = '';
      Default value is empty. This is the fully qualified filename of the Banlog or Ban list. If $useBanlist is set to false, this will not be used.
      $redirOnBan = '';
      Default value is empty. This is the fully qualified landing page if the form is submitted by a banned user. If $useBanlist is set to false, this will not be used.
      $allowedFileTypes = "doc|xls|pdf|jpg|jpeg|png|gif|zip|rar|gz";
      Default value is doc|xls|pdf|jpg|jpeg|png|gif|zip|rar|gz. These are the file extensions of files that will be accepted to attach in the email sent to the recipient. Please note, this is a test of the file extension only, not a test of the contents of the file.
     

    Your PHPMailer-FE program is now configured.
    Individual Form Configuration
    The action of your form needs to point towards "phpmailer-fe.php", and the method must be POST (GET method will NOT work and is NOT secure). Below is a list of form fields you can use and how to implement them. You can specify individual form configuration on a form-by-form basis (ie. 'form.config.php', or globally (ie. 'default.config.php' or in the script). Review the samples in the download file.

    Optional Form Fields

    Field:  recipient
    Description:  This form field allows you to specify the email address your form results to be emailed. Enter multiple recipients by separating the email addresses with commas.

    It is recommended that you enter this information in the script or the form configuration file, not as a hidden field in the form.

    Syntax:  <input type="hidden" name="recipient" value="email@yourdomain.com"> OR
    <input type="hidden" name="recipient" value="user@yourdomain.com,user2@yourdomain.com">

    Optional Form Fields

    Field:  bcc
    Description:  This form field allows you to specify the email address your form results to be Blind Carbon Copied to. Enter multiple recipients by separating the email addresses with commas.

    It is recommended that you enter this information in the script, not as a hidden field in the form.

    Syntax:  <input type="hidden" name="bcc" value="emailbcc@yourdomain.com"> OR
    <input type="hidden" name="recipient" value="userbcc@yourdomain.com,user2bcc@yourdomain.com">

    Field:  cc
    Description:  This form field allows you to specify the email address your form results to be Carbon Copied to. Enter multiple recipients by separating the email addresses with commas.

    It is recommended that you enter this information in the script, not as a hidden field in the form.

    Syntax:  <input type="hidden" name="cc" value="emailcc@yourdomain.com"> OR
    <input type="hidden" name="recipient" value="usercc@yourdomain.com,user2cc@yourdomain.com">

    Field:  subject
    Description:  The subject field will allow you to specify the subject that will appear in the email sent to you after the form is submitted. Default subject is "Form Submission".
    Syntax:  <input type="hidden" name="subject" value="Your Subject">

    You can also let the user enter a subject:
    <input type="text" name="subject">

    Field:  email
    Description:  For the user to specify their email address. This will be used as the From: field of the message you receive. If you want to require an email address with valid syntax, add this field name to the require field.
    Syntax:  <input type="text" name="email">

    Field:  realname
    Description:  The realname form field provides the user the ability to input their real name. Useful, and will also be used in the From: line of your email message header.
    Syntax:  <input type="text" name="realname">

    Field:  attachment
    Description:  The 'attachment' form field provides the user the ability to upload a file to you. The file will NOT be stored on the server. It will be sent by email only. Please note that if you use this capability, you will have to adjust your form tag to support file uploads. Other than that, there is no other code requirement on your part, the entire upload process is handled by PHPMailer-FE. You also need to note that there is no restriction on file type, or on
    Syntax:  <input type="text" name="realname">

    Field:  redirect
    Description:  If you wish to redirect the user to your custom landing page after they submit a form (vs having them see the default message), you can use this in a hidden form field to send them to your custom pre-made HTML page.
    Syntax:  To choose the URL they will end up at:
    <input type="hidden" name="redirect" value="http://www.yourdomain.com/thanx.html">

    Field:  require
    Description:  You can require certain fields in your form to be filled in before the user can submit the form. Place all field names that you want to be mandatory into this field. If the required fields are not filled in, the user will be notified they need to further fill in, and a link back to the form they just submitted will be provided.

    To use a customized error page, see missing_fields_redirect
    Syntax:  If you want to require that they fill in the email and phone fields in your form, use syntax like:

    <input type="hidden" name="required" value="email,phone">

    Field:  env_report
    Version:  1.3 & Up
    Description:  Allows you to have system environment variables included in the email message you receive. Useful if you wish to know what browser, domain, or any other attributes associated with environment variables. The following is a list of valid environment variables:

    REMOTE_HOST Sends the hostname of the user's ISP.
    REMOTE_ADDR Sends the IP address of the remote host making the request.
    REMOTE_USER If server supports authentication and script is protected, this is the username they have logged in as. Note: not commonly used.
    HTTP_USER_AGENT  The browser the client is using to fill in and send the form.
    HTTP_REFERER  The web page the user came from to land on your form.
    Syntax:  If you wanted to find the remote host and browser submitting the form, you would put the following into your form:

    <input type="hidden" name="env_report" value="REMOTE_HOST,HTTP_USER_AGENT">

    Field:  sort
    Description:  This field allows you to choose the order for your variables to appear in the email that PHPMailer-FE generates. You can choose to have the field sorted "alphabetic" or specify a set order in which you want the fields to appear in your mail message. By leaving this field out, the order will default to the order in which the browsers sends the information to PHPMailer-FE (usually the same order as they appear in the form.) When sorting by a set order of fields, you should include the phrase "order:" as the first part of your value for the sort field, and then follow that with the field names you want to be listed in the email message, separated by commas.
    Syntax:  To sort alphabetically:
    <input type="hidden" name="sort" value="alphabetic">

    To sort by a set field order:
    <input type="hidden" name="sort" value="order:name1,name2,etc...">

    Field:  print_blank_fields
    Description:  print_blank_fields requests that all form fields are included in the email, regardless of whether or not they were filled in. PHPMailer-FE defaults off, so that unused form fields aren't emailed.
    Syntax:  If you want to include all blank fields:

    <input type="hidden" name="print_blank_fields" value="1">

    Field:  title
    Description:  This form field allows you to specify the title and header that will appear on the resulting page if you do not specify a redirect URL.
    Syntax:  If you wanted a title of 'Feedback Form Results':

    <input type="hidden" name="title" value="Feedback Form Results">

    Field:  return_link_url
    Description:  This field allows you to specify a URL that will appear, as return_link_title, on the resulting report page. This field will not be used if you have the redirect field set, but it is useful if you allow the user to receive the report on the following page, but want to offer them a way to get back to your main page.
    Syntax:  <input type="hidden" name="return_link_url" value="http://yourdomain.com/main.html">

    Field:  return_link_title
    Description:  This is the title that will be used to link the user back to the page you specify with return_link_url. The two fields will be shown on the resulting form page as:

    return_link_title
    Syntax:  <input type="hidden" name="return_link_title" value="Back to Main Page">

    Field:  missing_fields_redirect
    Description:  This form field allows you to specify a URL that users will be redirected to if there are fields listed in the required form field that are not filled in. This is so you can customize an error page instead of displaying the default.
    Syntax:  <input type="hidden" name="missing_fields_redirect" value="http://yourdomain.com/error.html">

    Field:  background
    Version:  1.3 & Up
    Description:  This form field allow you to specify a background image that will appear if you do not have the redirect field set. This image will appear as the background to the form results page.
    Syntax:  <input type="hidden" name="background" value="http://www.yourdomain.com/imgs/image.gif">

    Field:  bgcolor
    Description:  This form field allow you to specify a bgcolor for the form results page in much the way you specify a background image. This field should not be set if the redirect field is.
    Syntax:  For a background color of White:
    <input type="hidden" name="bgcolor" value="#FFFFFF">

    Field:  text_color
    Description:  This field works the same as bgcolor, except that it will change the color of your text.
    Syntax:  For a text color of Black:
    <input type="hidden" name="text_color" value="#000000">

    Field:  link_color
    Version:  1.3 & Up
    Description:  Changes the color of links on the resulting page. Works the same as text_color. Should not be defined if redirect is ised.
    Syntax:  For a link color of Red:
    <input type="hidden" name="link_color" value="#FF0000">

    Field:  vlink_color
    Description:  Changes the color of visited links on the resulting page. Works the same as link_color. Should not be set if redirect is used.
    Syntax:  For a visited link color of Blue:
    <input type="hidden" name="vlink_color" value="#0000FF">

    Field:  alink_color
    Description:  Changes the color of active links on the resulting page. Works the same as link_color. Should not be set if redirect is used.
    Syntax:  For a active link color of Blue:
    <input type="hidden" name="alink_color" value="#0000FF">

    Field:  WorxTuringTest
    Description:  This is a special field. It is referred to as a Turing test or "captcha" utility. It is a server side solution ... validation does not occur until after the user has submitted the data. If you want to use the Turing test, insert this in your form:
    <img src="worxturing.php"><br />
    Enter security code:<br />
    <input name="WorxTuringTest" id="WorxTuringTest">

    You can read more about the Turing test (or captcha utility) at Wikipedia.

    Please enjoy PHPMailer-FE. At Worx International Inc., we have been using this software for more than 3 years. We have built an entire Remote Forms Processing strategy and commercial service around it. It's robust, and when used in conjunction with PHPMailer or PHPMailer-Lite, will send out attractive HTML forms.
    Design by WorxStudio.com Copyright © 1999-2009, Worx International Inc. All Rights Reserved. Privacy Policy