org_heigl/contact

Contact-Form using a honeypot for spam-protection

1.0.1 2017-02-18 19:00 UTC

This package is auto-updated.

Last update: 2024-10-23 10:13:55 UTC


README

Build-Status Coverage Status Scrutinizer Code Quality Code Climate Codacy Badge SensioLabsInsight

Latest Stable Version Total Downloads License composer.lock

This Modules provides a simple contact-form with spam-protection using a honeypot. It is based on the PhlyContact-Module by Matthew WeierOPhinney.

The idea of the honeypot is based on a blogpost by Lorna Jane Mitchell

The contact form is for example used at php.ughttps://php.ug/contact) and so far I haven't had spam from it in over 4 years. So the honeypot seems to be working. :)

Installation

Install the package using composer.

    composer require org_heigl/contact

Usage

  1. In your application.conf-file add the Module to the list of modules
    return [
         'modules' => [
             'Org_Heigl\Contact',
         ]
    ]
  1. Configure your settings by copying the file vendor/org_heigl/contact/config/module.org-heigl-contact.local.php.-dist to your applications autoload-folder (removing the .dist on the way) and then altering the content.
    return [
        'OrgHeiglContact' => [
            'mail_transport' => [
    //           'class'   => 'Zend\Mail\Transport\Smtp',
    //           'options' => [
    //               'host'             => 'localhost',
    //               'port'             => 587,
    //               'connectionClass'  => 'login',
    //               'connectionConfig' => [
    //                   'ssl'      => 'tls',
    //                   'username' => 'contact@your.tld',
    //                   'password' => 'password',
    //               ],
    //           ],
                 'class'  => 'File',
                 'options' => array(
                     'path' => sys_get_temp_dir(),
                 ],
            ],
            'message' => [
                 // These can be either a string, or an array of email => name pairs
                'to'     => 'contact@your.tld',
                'from'   => 'contact@your.tld',
                // This should be an array with minimally an "address" element, and
                // can also contain a "name" element
                'sender' => array(
                    'address' => 'contact@your.tld'
                ],
            ],
        ],
    ]

For the mail_transport-settings you may want to have a look at Zend\Mail.

  1. Link to the Form using $this->url('contact') in your view. This will render the form in your view.
  2. There is no step four.