Question

I am writing a ZF Application that generates emails as certain actions occur, e.g. when a user signs up. My default mail settings are set in a Mail Resource plugin.

My question is, what's the best approach to managing the email templates? They could be text files, .ini, or in the code itself.

It seems to me that text files would be the easiest, but I'm always cautious about introducing another kind of file type that needs to be managed. Has anyone tried using .ini? How does this work?

Was it helpful?

Solution

You can store your email template in following directory

Create an view script like : /views/emails/template.phtml

<body>
<?php echo $this->var1; ?>
<h1>Welcome</h1>
<?php echo $this->var2; ?>
</body>

Please see this is already post on stackoverflow this might be helpfull for you How can I make email template in Zend Framework? and another solution also posted What is the best way to use Email Template in Zend/PHP

OTHER TIPS

I would say - definitively not in the code! It will just make your code mixed up with representation, which you want to show to the user. Plus if your site is multi-language - it will make you to have even bigger mess... Good idea would be to use some kind of template engine. As example: How can I make email template in Zend Framework?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top