Jump to content

Recommended Posts

Posted

WireMailBranding
Add email templates to wireMail
 
From this:

$mail->bodyHTML("<h1>Hello</h1><p>I'm WireMailBranding</p>");

To this:
post-577-0-38841600-1446043663_thumb.png
(or whatever template you create)
 
How it works?
Create an email template without content. On the spot where you wish to have your content place the tag {bodyHTML}.The markup you've set with $mail->bodyHTML('<p>Markup</p>'); will replace that tag.
 
You could set the defaults in the Module configuration or set the properties with the API. (See below) The API will overwrite the default settings :-)

$mail = wireMail();
$mail->to('user@some-domain.ext')->from('you@own-domain.ext');
$mail->subject('Mail Subject');
// Set path to template (overwrites default settings)
$mail->template('/site/templates/template_wrapper.php');
// Enable/Overwrite the Emogrifier CSS inliner. (0, bodyHTML, wrapper)
$mail->inlineCSS('bodyHTML');
$mail->bodyHTML('<p>This paragraph will replace the {bodyHTML} tag in the mail template.</p>');
$mail->send();

CSS inliner 

We have added the beautiful css inliner Emogrifier to inline the CSS styles. When using the Emogrifier CSS inliner applying it on the bodyHTML only is the most efficient way. We recommend you to write the inline styles for the wrapper manually.
 
The module is sponsored by Calago.nl. Thanks guys !


Updates

0.1.2

Bug fixes :

- Fixed redeclare Emogrifier bug.

Improvement

- Added error logging for Emogrifier

- Added inputfield error for the lack of PHP's mbstring in the module configuration.

- Some code cleaning and other cosmetics

 

0.1.3

Bug fixes :

- Fixed bug when module couldn't grab bodyHTML (resulted in doing nothing at all).


 
GitHub
https://github.com/Da-Fecto/WireMailBranding

Modules directory

http://modules.processwire.com/modules/wire-mail-branding/

  • Like 18
Posted

I could indeed do that, but I have already implemented a templating system which gives flexibility in terms of defining plain and rich templates. Inlining CSS (as opposed to prepending a stylesheet) is a great thing for email templates, as it ensures client compatiability. So I'd like to include that specific class in SimpleForms.

That said, I could look into providing the option of using your module in SimpleForms, provided it is installed.

Will look into this soon.

(Side note: Development of SimpleForms (and the new Jumplinks) is paused at the moment as I cannot dedicate enough time in my day to working on it. Hope to start again soon - it is still fresh in my mind.)

  • Like 2
  • 2 weeks later...
  • 1 month later...
Posted

Martijn I have a problem when I have installed Mail Branding and wireMailSMTP together I get the below error :

Error: Exception: Method WireMailSmtp::template does not exist or is not callable in this context (in /home/omegatel/public_html/wire/core/Wire.php line 358)

My Silly mistake downloaded the module but didn't installed it :D

  • Like 1
Posted

Martjin one question is there anyway to send some dynamic data also to the wrapper it self ?for example we have placed the {bodyHTML} inside our content box and I want to also send data to another part of my template. How can I achieve this?

Best Regards,

Ali.M

Posted (edited)

Not sending to the wrapper. Maybe you could access what you want from the wrapper with the wire('') functions.

When you use this module from a normal page page is available with wire('page').

You could also add your variable to the config, later-on in the wrapper you could access that with wire('config')

Edited by Martijn Geerts
Posted

no I have a form that after save I send an email to client I want to send some of the data from the form to wrapper itself for example in the footer

Posted

Thank you very much I will take look and poke it a little bit and will update the topic.

Great module and thank you for making such a cool module.

Posted

Martijn another issue I have WireMailSMTP and also using your module too now when I have such code as below:

$mail = wireMail();
$mail->sendSingle(true);
$mail->to('sradesign.net@gmail.com', 'Ali Mahmoudi');
$mail->cc(array('ali@vinsonfinancials.com'));
$mail->from = 'info@vinsonfinancials.com'; 
$mail->fromName = 'Vinson Financials';
$mail->subject('Test');
$mail->bodyHTML($fullname.' Account Details Have Been Updated Successfully');
$numSent = $mail->send();

it trough me errors like below:

Error: Exception: Method WireMailBranding::sendSingle does not exist or is not callable in this context

or

Error: Exception: Method WireMailBranding::cc does not exist or is not callable in this context
Posted

Both methods don't exist in my module. I'll create an issue on GitHub to remind my self.

Will take a look at later how to solve it. Maybe I can solve it with a magic method.

Posted

How the class is written now it don't has access to WireMailSmtp, as WireMail is the parent class and not WireMailSmtp. To make it work with not known methods it needs a total rewrite, if even possible. But there's a work around.

// This don't work with methods not know by WireMail
$mail = wireMail();

// When you instantiate WireMailSmtp yourself it all works
$mail = $modules->get('WireMailSmtp');
 
  • Like 2
  • 1 month later...
Posted

How the class is written now it don't has access to WireMailSmtp, as WireMail is the parent class and not WireMailSmtp. To make it work with not known methods it needs a total rewrite, if even possible. But there's a work around.

// This don't work with methods not know by WireMail
$mail = wireMail();

// When you instantiate WireMailSmtp yourself it all works
$mail = $modules->get('WireMailSmtp');
 

This worked for me too.

Would really like if i could implement dynamic data in the email?

Not sending to the wrapper. Maybe you could access what you want from the wrapper with the wire('') functions.

When you use this module from a normal page page is available with wire('page').

You could also add your variable to the config, later-on in the wrapper you could access that with wire('config')

Is this the only way to implement this at the moment?

Posted

Is this the only way to implement this at the moment?

The Module is in the scope of the class, so you need the wire scope. All ProcessWire variables have those functions so things are reachable. That's for the wrapper.

The bodyHTML method can be used in a template, so it's up to you what you do there.

  • Like 1

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
×
×
  • Create New...