An elegant way to send "generic" email messages
| From: | Nebbe, Joelle | Date: | Fri, 10 Nov 2000 14:45:59 +0000 |
| Subject: | An elegant way to send "generic" email messages | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-24657@lists.php.net to get a copy of this message | ||
Hello all
Most web apps need to send confirmation emails, or welcome emails, or other
forms of generic email messages.
By generic I mean a message that is only customised by a few variables, i.e.
name and email address and maybe a specific link or ID.
Now most examples of php I have ever seen always seem to build those
messages in the code. This is not really an acceptable solution as it is
usually not the developer who writes the text of the message but the same
people who work on the wording of the content of the site, or maybe the
designer i.e. people you don't want to allow free access to your php code.
Now with html documents and templates this is easy, as you can use bits of
php code <?php echo $thisvariable ?> in your templates and call them through
include, or use one of the simple templating schemes. These don't work with
email as I don't want the result to go to the default output but to a
variable that will be the message body.
What I want is the equivalent of <<<Eof but with an external file.
So what's left?
1. the manual parse/replace approach (i.e. read the file, replace every
##variable## by $variable and plug the result in $message)
2. put the email message in a php routine after all, and have to edit it
every single time someone decides that "greetings" is better than "hello"
after all.
Is there not a more elegant way? I cannot help but think I'm overlooking
something
Joelle Nebbe
_______________________________________________________________________
Any opinions expressed in the email are those of the individual and not
necessarily the company. This email and any files transmitted with it
are confidential and solely for the use of the intended recipient.
If you are not the intended recipient or the person responsible for
delivering to the intended recipient, be advised that you have received
this email in error and that any use is strictly prohibited.
If you have received this email in error please notify the IT manager
by telephone on 0113 243 2701
_______________________________________________________________________