Email Template is a plugin for Frog CMS. It provides new page type named Email template. You can use these pages as POST target to your forms. You have full control on the layout of the email sent.
Copy files to frog/plugins/email_template/ folder. If you do not have access to Git use this download link instead. Local installation file might come bit behind GitHub. So if you want bleeding edge use git clone.
cd frog/plugins/ git clone git://github.com/tuupola/frog_email_template.git email_template
Go to admin and enable Email Template plugin.
First you have to create a form. Lets create simple example contact form. Create a page named Contact and paste following HTML code as content of the page.
<form method="post" action="/contact/template"> Name: <input name="name" type="text" /><br /> Company: <input name="company" type="text" /><br /> Email: <input name="email" type="text" /><br /> <textarea name="message"></textarea> <br/> <input type="submit" /> </form>
Next create template for the outgoing email. In this example we create it as subpage for Contact and call it Template. Create the page and paste following as the content of the page.
To: Mika Tuupola <[email protected]> From: <?php print $_POST['name'] ?> <<?php print $_POST['email'] ?>> Subject: Frog Mail 1. Contact info Name ..........: <?php print $_POST['name'] ?> Company..........: <?php print $_POST['company'] ?> Email............: <?php print $_POST['email'] ?> 2. Message <?php print $_POST['message'] ?> -- Sent by <?php print $_SERVER['REMOTE_ADDR'] ?>
Make sure to change the following:
After saving the page structure looks something following:
You can now test send an email. Open the contact page. Fill in name, email and some random text. When you press submit you should see something like following:
This is the email which was just sent (assuming your PHP is correctly set up). Obviously you do not want to show this every time form is sent. Lets set up a thank you page.
For this example create a page called Thank You as subpage to Contact. You can use any page as thank you page. This is just an example.
Then add the following line into your form:
<input name="success" value="/contact/thanks" type="hidden" />
Now when you submit and sending the mail succeeds user is redirected to the thank you page. It is also possible to do a redirect when sending mail fails:
<input name="failure" value="/contact/fail" type="hidden" />