Kirby mailer wrapper plugin

lcd344/kirby-mailer-wrapper

I’ve created this plugin in preparation to integration I’m planning to do with PHPMailer to a different plugin, but since it can be used independently, and I saw some people asking about a PHPMailer mail drivers I decided to upload this now.

This plugin adds 3 things

  1. kirby mail log driver - this will just log your emails into a file - I like it for developing.
  2. kirby mail phpmailer driver. send your emails through smtp
  3. kirby mail wrapper class - basically just turns the regular syntax to a fluent api - which I find more readable.

So this -

$email = email(array(
  'to'      => 'mail@example.com',
  'from'    => 'john@doe.com',
  'subject' => 'Yay, Kirby sends mails',
  'body'    => 'Hey, this is a test email!'
));

$email->send() 

turns into

$mailer = new lcd344\Mailer('mail');
$mailer->to('mail@example.com');
       >from('ohn@doe.com');
      ->send('subject,'body');

cheers.

edit

updated the api a bit, I will also be next adding an optional panel page to mail users.

Version 1.0 has now been officially released. It includes a way to bind data and inject it into email body using mustaches.

3 Likes

Thanks for sharing :slight_smile:

Hello @LCD344,

If we decide to use your plugin, I suppose we have to update PHPMailer in your code to patch the last security issue ?
Indeed, your Github repository has not been updated since 5 months and the issue has been discovered last December.

I’m asking just to be sure :wink:

Updated!

thanks for the headsup - I actually updated it for myself and forgot to push it… now its good!
I hope you enjoy using it!