Contact Form

How to create a contact form with PHPMailer plugin.

Online Docs Available Looks like you are looking at the offline docs. You can find possibly more up to date docs online here

Contact Form

The contact form now uses the PHPMailer, which is a full-featured email creation and transfer class for PHP. For more about PHPMailer please visit the official website http://phpmailer.worxware.com/.
To setup your contact form you will need to edit the contact_mailer.php, contact_mailer_hotel.php, contact_mailer_reservation.php, contact_mailer_signup.php or contact_mailer_wedding.php file in the main theme folder. The first 62 lines can be modified to customise your contact form.

  1. Set the main host. It is by default set to smtp.gmail.com if you are using a GMail account. Other options are
    • Hotmail => smtp.live.com
    • Yahoo => smtp.mail.yahoo.com
    • Lycos => smtp.mail.lycos.com
    • AOL => smtp.aol.com
  2. Set the SMTP username and password. This is the email account that PHPMailer will use to send the email. Change some_email@email.com to the email that you want to use and secret to the password of that email, from lines 16, 17.
  3. Set the address that the email of the form will be delivered to. Change the receiver@mail.com from line 21 to the address that you want.
  4. Set the company name - When a message arrives in your inbox it will have a subject with your company name inside. To change this edit line 26 and change the your_company to your company name.
  5. Set which fields are required - to change which fields are required in your form you can edit the following

     $field_rules = array(
      'name' => 'required',
      'email' => 'required|valid_email',
      'message' => 'required'
     );

    Remove the lines of the fields you do not want to be required.

  6. Change error validation messages - to change the error messages that popup on the forms change the following section

     $error_messages = array(
      'required' => 'This field is required',
      'valid_email' => 'Please enter a valid email address'
     );
     // select where each inputs error messages will be shown
     $error_placements = array(
      'name' => 'top',
      'email' => 'top',
      'subject' => 'right',
      'message' => 'right',
      'submitButton' => 'right'
     );

$error_messages - defines the messages shown in the popups.

$error_placements - defines where the popups will appear on (top|bottom|left|right).

Keep in mind that you need to include the <script src="assets/js/contact.min.js"></script> at the and of the <body>.

contact-form