Jump to content

MarkupNewsletter


Nico Knoll
 Share

Recommended Posts

I use the FormTemplateProcessor for this and wanted (even started a bit) to write a module, but I've got my past hours all taken by client work. I think ryan's new Formbuilder already has this kind of functionality. Really looking forward because it can post to other systems as well.

Link to comment
Share on other sites

Nico, just out of curiosity: are you thinking about "just" the subscription part or a module that would actually handle the whole process from subscription (and cancellation) to building and eventually sending out a newsletter? :)

Link to comment
Share on other sites

I would suggest looking into Mandrill from those chaps at MailChimp. It's basically the sending/stats/bounce part of Mailchimp, leaving you to build the newsletter and subscriber database in ProcessWire.

Basically it's another alternative to what Antti mentioned above, and one I'm really curious to look into myself if I ever get time!

Colour me biased, but the pricing and features in Mandrill might be more appealing too (first 12,000 emails sent per month free).

  • Like 2
Link to comment
Share on other sites

Doesn't look like I will get the time for at least a few weeks, but what I had in mind for making an awesome newsletter module for ProcessWire is things like this:

  • Building templates in PW's template system (duh)
  • Being able to reference content from elsewhere on the site (like check out X amazin product/service) - essentially a repeater field for Service Title (if you want to override the page title you're referencing) short description (again, only if you want to override that page's summary), image from that page and then being able to drag and drop that sort of content quickly into any order.
  • And so on

It's really exciting when you think about all the possibilities of what you can do just by creating each newsletter content as a normal page and template combination, so I think that any such module should leave that completely separate and just focus on:

  • Subscribes/unsubscribes - a default system to store subscribers as users with a guest and newsletter role (I think it should be this anyway) and make the class so it can easily be extended to add/remove/deal with subscribers any other way someone can think of
  • Sending mail
  • Dealing with bounces (from systems like Mandrill, although if you read the info it deals with a lot of this itself if you forget to remove bad addresses - it just won't send to them again to keep you compliant and will notify you, which is nice)

These are the basics and I think it could just be a case of keeping it this basic - everything else is a case of PW pages and templates then, plus a bit of a headache in terms of making all your styles inline once again like back when you didn't know what a stylesheet was ;) For that reason alone, perhaps it should ship with a default page, some fields and a template as an example?

It could well be that this is complex enough to warrant another paid module, especially when you start thinking about shipping it with a selection of templates, or considering ways to make it easy to download new templates from within the module (probably a version 2 feature!).

  • Like 4
Link to comment
Share on other sites

  • 1 month later...

Hi this was discussed a little in another thread:

http://processwire.c...age__hl__mailer

I actually use templates and Mandrill to send some of my transactional emails such as welcome emails and confirmations. It's relatively easy to do this using SMTP. Here's an example:

<?php
require_once "Mail.php";
require_once "Mail/mime.php";

$email = new Page();
$email->template = $templates->get("email-template");
$email->somePageVariable = "example";
$email->setOutputFormatting(true);
$body = $email->render();

// Header info
$from = "<info@yoursite.com>";
$to = "<user@name.com>";
$subject = "Thank you for registering!";

// Send via Mandrill
$host = "ssl://smtp.mandrillapp.com";
$port = "465";
$username = "info@yoursite.com"; // Your mandrill user name
$password = "secretKey"; // Your mandrill API key

$headers = array (
'From' => $from,
'To' => $to,
'Subject' => $subject,
);

$smtp = Mail::factory('smtp', array (
'host' => $host,
'port' => $port,
'auth' => true,
'username' => $username,
'password' => $password
));

$message = new Mail_mime();
$message->setHTMLBody($body);
$mail = $smtp->send($to, $message->headers($headers), $message->get());

if (PEAR::isError($mail)) {
echo($mail->getMessage() . "\n");
} else {
echo("Message successfully sent!\n");
}

Because the template can pull in content anywhere from your site, you can easily make templates for upcoming events, latest news, etc.

For inlining CSS, premailer now offers an API. I think it's best to use netcarver's tag parser for user-specific details when bulk mailing. You could render these in the template and pass in the user ID to that, but then you'd have to inline the CSS after rendering each and every email. It should be possible to avoid this by rendering the template, sending to premailer, and then looping through the recipients replacing the first_name, surname etc. I've not tried this out yet though.

Stephen

  • Like 4
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...