Mail Handler: Simple form-mail with attachments

I put together this script for my friend huphtur and figured it was worth posting so other people could use it. It’s very customizable but requires you to configure all of the fields you’ll be using and create a template for the email message. Here’s the quick readme.txt I put together:

mail-handler

This is a simple formmail tool that is fairly customizable and works with attachments. Instructions:

Create a form and point it at mail-handler.php.

Edit mail-handler.php to call out field names and types (string, text, email, file), specify which fields are required, and configure the message. $formvars should call out all fields being sent from the form, and their types. $required should contain an array of fields required before the message will be sent. $email contains the actual email configuration, including template filename, To:, From:, Cc:, Bcc:, which files to attach, and where to direct the browser on success or failure.

Create a message template. mail-handler.php will automatically replace text such as %name% with a form variable called ‘name’ if it is specified in the configuration. It also includes %remote_ip% and %date% by default.

Cross your fingers and try it out.

Download: mail-handler-0.1.tar.gz

test.php (in the .tar.gz) is the sample form.

1 Comment »

  1. huphtur said,

    October 20, 2006 @ 10:27 am

    Works like a charm. Thanks dude!

RSS feed for comments on this post · TrackBack URI

Leave a Comment