Skip to content
Web application that sends out mails via a contact form.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
config
resources
src/mailform
templates
tests/mailform
.codacy.yaml
.editorconfig
.gitignore
.travis.yml
CHANGELOG.md
Dockerfile
LICENSE
README.md
composer.json
composer.lock
docker-compose-with-db.yaml
docker-compose.yaml
index.html
phpinfo.php
phpunit.xml

README.md

mailform

Send out a given mail via a web form.

Allows sending mails to a configured and given mail address.

Badges - remote integrations

Build Status

codecov

Codacy Badge

Github Project Mailform

Apache v2.0

PHP project init

PHP

Project requires at least PHP 7.2.

Ubuntu

Depending on your installation you may need to install a more recent PHP version, as I had to do on Ubuntu 18.0.4 LTS: https://tecadmin.net/install-php-7-on-ubuntu/

  • Upgrade to PHP 7.2
sudo apt-get install -y php7.2
  • Additional modules:
sudo apt install php7.2-xml php7.2-mbstring php7.2-mysql php7.2-intl php7.2-sqlite3 php-xdebug sqlite3

Mac

$ brew install php@7.2

In case you have older versions of PHP installed follow this cleanup procedure: https://medium.com/@romaninsh/install-php-7-2-xdebug-on-macos-high-sierra-with-homebrew-july-2018-d7968fe7e8b8

If you have multiple PHP versions and need to switch per project you may need this:

$ brew install brew-php-switcher

Composer

php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('sha384', 'composer-setup.php') === '48e3236262b34d30969dca3c37281b3b4bbe3221bda826ac6a9a62d6444cdb0dcd0615698a5cbe587c3f0fe57a54d8f5') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"

done with version 1.8.4.

Project init

$ ./composer.phar init

Project layout

tbd: https://getcomposer.org/doc/01-basic-usage.md#introduction

Base structure

following https://blog.nikolaposa.in.rs/2017/01/16/on-structuring-php-projects/

bin/              # command-line executables
config/           # configuration files
public/           # web server files, assets
resources/        # other resource files
src/              # PHP source code
templates/        # view and layout files
tests/            # test code

PHPUnit setup

https://phpunit.de/getting-started/phpunit-8.html

$ composer require --dev phpunit/phpunit ^8 (needs a modern PHP)

PHPMailer integration

In order to integrate PHPMailer you may want to run:

$ composer require phpmailer/phpmailer

Templates

The mail form web template is based on Html5UP ReadOnly which is available under Creative Commons Attribution 3.0 Unported

Favicon

The used favicon House is taken from FreeFavicon.

Application configuration

This application can be configured if used in you own context. Please copy the given template mailform-config.php.template to mailform-config.php in the config-directory.

Docker integration

With a more recent Docker setup you may simply run:

$ docker-compose up

If you see something like:

Recreating mailform_php-apache_1 ... done
Attaching to mailform_php-apache_1
....

you are ready to visit http://localhost:8888 to see the application up and running.

In case you need to tweak PHP settings: http://localhost:8888/phpinfo.php might be of use - please remove this file in production deployments!

HINT! Even if you enable mail sending this will not work from within the container - you need to deploy the application first :-)

You can’t perform that action at this time.