Send a templated email from a website where the template is hosted elsewhere?
April 1, 2009 10:44 AM
Subscribe
Send a templated email from a website where the template is hosted elsewhere?
I want to setup a website that hosts a templated email form that someone can fill out their name and their friend's email address and it will send the templated email to their friend and fill in the variable of their name so the friend knows who sent it. Standard stuff, I think.
However, I would like to put the actual form itself on a completely different website because on this different website I will have much less access and can only post HTML, CSS, Javascript, etc. and not actually store a template or anything like that.
Is there an easy way to do this? Everything I've seen so far would require both the form and the templated data to be in the same place.
posted by doomtop to computers & internet (4 comments total)
1) Most templating engines have a "load template from file" function as well as something like "load template from variable".
Most programming languages (such as PHP) have a "load from URL" function. I suggest you combine the "load from url" function from your programming environment with the "load template from variable" - or, if your template engine has no "load template from variable" (such is the case with Smarty), fetch the template, put it in a temporary file (which *all* programming environments will have) and tell the template engine to get the template there.
But all that depends on which language and template engine you have available
2) if all you have on the website is static html, you're never going to send mail from that website anyway, so you'll end up with static html that reads like this:
<form action="http://otherserver.with.template.com/mailsendingscript.php">
<input type=text .. .etc >
and that means putting all the programming and mail-sending logic on the server that *has* the template.
posted by DreamerFi at 11:15 AM on April 1