Package email template
PermalinkFor the blocks I use installBlockTypeFromPackage. Is there something like 'installEmailTemplateFromPackage'?

I also have a package I am trying to put together and I am looking for a way to install a mail template from the package. I also can't figure out how to install a php file in models. Right now, I have to manually copy a few files into the appropriate directories, but it would be nice if the package controller could handle them. The docs only seem to address single pages and blocks but not other types of files.
The solution I do use is this:
1. Format the email body with HTML tags and all in one string.
2. Create a Zend_Mail object (I copied some bits and pieces from the mail helper).
3. Put the email string into the HtmlBody of the Zend_Mail object.
4. Add email addresses for to, from, cc, bcc, replyto et cetera, and add attachments.
5. Send the whole thing of.
This makes nicely formatted emails with all the bells and whistles you could wish for.
As for your second issue: a lot of things can be done in the install function of the package controller. Moving files around, adding data to the database, and what not. It's just that only a limited set of functions are available for installing specific much used objects. A mail template could of course be moved to the right place 'by hand'. Convenient? Maybe not. But providing an API function for anything and everything imaginable isn't either.
Put mail template in packages/<your_package>/my_template.php.
Loading a mail template from package:
$mh->load("company_new_account_information", "your_package_handle");
For HTML-mails: Use bodyHTML in <your_package_handle>/mail/my_template.php
[code]
// html mail content
$bodyHTML = t("<h2>Meine Email</h2>
<p>Username: %s</p>",
$username);
// normal text content would be $body
[code]
Full documentation here:
http://www.concrete5.org/documentation/developers/helpers/mail...
No need to set something up in package/controller.php.
( I know the thread is from 2010, but I stumbled about it and saw no better threads in the meantime, so I posted it here for other readers )