Pages

Tuesday, January 10, 2012

Email template with PHP and MySQL

In this video I demonstrate how to read static HTML file that contains field names in curly brackets and replace them with values from a MySQL query field value and then send it to a customer.

Some time ago I was creating a website for a tour company. They wanted Paypal integration. I tested it on Sandbox and it all worked fine. After receiving confirmation from Paypal, a script proceeds to update the booking and set it as paid and sends the customer an email (replacing field names with field values from the database).

For example: "Dear {customer}" would become "Dear Axel Torvalds" (Swordfish anyone?).



Video starts at 30 seconds.  Still, take a listen from the start. 


Ideas
Create a more detailed and nicer-looking email in spreadsheet software such as OpenOffice.org / LibreOffice and export it to HTML.

No comments:

Post a Comment