3

I have created a responsive email "template" that I use at work where we create anywhere from 5 to 40 emails a month. It has become a hassle to change out the text every time I have a new client to create the email for.

My goal was to create a page with an html form with fields for (file name, and various other text fields) and have the submitted results output to this newly created file based on the email template I originally created. However, I can not seem to find anything on the subject. Does anyone know of a good place to start?. Even if the result were just output to a div at the bottom of the page (after filling out the form), we could easily create the new file.


I have created the HTML file that houses the HTML forms. However, I am bit lost on how to actually take those fields, plug them into the sections on the template, and then output the newly created template either to a div (to be copied to a new file.

Sorry if I have not explained my question very well. The web form (that will populate the email template) will be used solely by me on my own local host (using MAMP Pro), so no one outside will have access to the form. I am simply trying to "speed up" the process of filling out the email templates, as these emails are pretty much the exact same every month (it can get a bit hectic).

Louis Stephens
  • 790
  • 1
  • 16
  • 35
  • This isn't rocket science, what have you tried? Also please note that if your IP address is not white listed and you start sending large quantities of bulk emails then firstly your ISP will probably block your email as they may think your server is sending out spam and also your IP address may get blacklisted which will cause issues when you aren't send bulk emails but customer orders or general emails. – Liam Sorsby Dec 14 '13 at 13:49
  • So you're asking how to create a form processing PHP file which attaches the fields to a string template? – mtanti Dec 14 '13 at 14:00
  • @mtanti,I believe you have hit the nail on the head. – Louis Stephens Dec 14 '13 at 14:02

2 Answers2

0

I think this post can help you. It discuss about generating HTML from JSON or XML.

You can create a form and use Jquery or PHP to edit your JSON or XML file for all client and generate the HTML code for save it to HTML with your template structure.

Community
  • 1
  • 1
GeoStoneMarten
  • 533
  • 1
  • 7
  • 19
0

In PHP you just attach the POST fields to the template string.

Let's say you have the following html form:

<form action="form.php" method="POST">
   <input type="text" id="firstname" name="firstname" />
   <input type="text" id="lastname" name="lastname" />
</form>

Then the form processing php file would look like this:

<?php
    $firstName = $_POST['firstname'];
    $lastName = $_POST['lastname'];

    $template = "
Dear $firstName $lastName,
Here is a message.
Regards,
Me
    ";

//send $template via email
?>

As already mentioned, be careful of sending bulk emails yourself as you could be marked as spam.

mtanti
  • 794
  • 9
  • 25