Here's a module I wrote that adds templates to Mass Mailer. Basically, templates can be created and they show up as a menu on admin/massmailer/message/send. Select a template and page is reloaded with template as body.

Your comments are welcome.

-Jeff

Comments

jjeff’s picture

Version: master »
StatusFileSize
new4.22 KB

Fixed a minor bug that caused the template menu not to link correctly when there was no list value in the URL.

crunchywelch’s picture

ok, took a look, i think this wil lbe very useful but we need to change a few things.

First, I would rename your module to massmailertamplate and remove the underscore. It's less readable, but otherwise you have the possibility of running over my namespace if I need to use massmailer_template as a function. This is sort of a drupal standard that was recently discussed on list, no worries, it should not take too long to do a find and replace.

Next, i added a few hooks in massmailer for you to use instaed of your patch. First, I call module_invoke_all('massmailer_create_message_links'); where you can return links to be included next to the 'create new message' link on the messages page. From there I would add a 'use message template' link. This way you dont have to have all the javascript warnings from the edit message page and it leave the edit page cleaner. The 'use message template' link should land you on a massmailertemplate page that lists the templates for you to select with links, look into the pager system, it's very useful for displaying pages like this.

Secondly, I added two more parameters to the create message url, a callback and an id value. So, you can do: admin/massmailer/message/send/$lid/$callback/$callbackid where:
$lid - the id number of the list to send to
$callback - the name of the module to load the $msg object from
$callbackid - an id number passed to the callback module

So, in your case, you can do admin/massmailer/message/send/1/massmailertemplate/4 and the function massmailertemplate_message_form(4) would be called. You return a message object, which is used to drop the values into the edit form. This way other plugin developers can use the same system.

Hope this makes sense and helps out. I also created a plugin directory for you to commit this to once it's all setup...

Thanks!

-A

jjeff’s picture

Cool! Sounds good. And yes, in addition to the namespace problems, "massmailer_templates.module" is just a ridiculously long name for a module. So even removing the underscore character helps! :-)

I'll take a look at things when I get a chance in the next few days and make the appropriate changes.

In the meantime, anyone have any ideas for a better (shorter) module name?

Does mmtemplates.module work?

-Jeff

jjeff’s picture

StatusFileSize
new4.01 KB

Okey doke. Here's the new and improved version of massmailertemplate.module.

There are now ties into the new massmailer hooks and a few other nips and tucks.

Enjoy!

jjeff’s picture

killes@www.drop.org’s picture

this is now in the plugins directory in cvs.

Anonymous’s picture

Anonymous’s picture

Anonymous’s picture

jjeff’s picture

Version: » 4.6.x-1.x-dev
Status: Fixed » Closed (fixed)
nausicaa’s picture

Status: Closed (fixed) » Active

The PHPList program uses placeholders like "[CONTENT]" to replace content into the templates it uses. It would be really nice if the templates could use this idea rather than the current implementation which simply presents the text entered in the template to the user when creating a new message.

In other words:
1) Create a template in PHP (ideal) or HTML containing the layout and special tags like [CONTENT] [SUBSCRIBE] [UNSUBSCRIBE]
2) When "using" a template, display an empty textarea where new HTML or text can be inserted.
3) Replace the [CONTENT] tag in the template with the text entered in the textarea for the new message.

Also, and this may be another issue, I would like to have the reply-to e-mails be set in the template. They could be editable in the message but I want them to appear automatically.