Martijn Geerts Posted October 28, 2015 Share Posted October 28, 2015 WireMailBrandingAdd email templates to wireMail From this: $mail->bodyHTML("<h1>Hello</h1><p>I'm WireMailBranding</p>"); To this:(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). GitHubhttps://github.com/Da-Fecto/WireMailBranding Modules directory http://modules.processwire.com/modules/wire-mail-branding/ 18 Link to comment Share on other sites More sharing options...
Mike Rockett Posted October 28, 2015 Share Posted October 28, 2015 Great module, Martjin! And thanks for the hat-tip on Emogrifier - I can definitely make use of that in SimpleForms. Link to comment Share on other sites More sharing options...
Martijn Geerts Posted October 28, 2015 Author Share Posted October 28, 2015 When SimpleForms use wireMail you only have to install this module and create a template. On the place you want to have your markup place the {bodyHTML} tag. Link to comment Share on other sites More sharing options...
Mike Rockett Posted October 28, 2015 Share Posted October 28, 2015 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.) 2 Link to comment Share on other sites More sharing options...
Martijn Geerts Posted November 12, 2015 Author Share Posted November 12, 2015 Bug fix where the module didn't served the wrapper at all. Updated the first post. 1 Link to comment Share on other sites More sharing options...
Sradesign Posted January 4, 2016 Share Posted January 4, 2016 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 1 Link to comment Share on other sites More sharing options...
Sradesign Posted January 4, 2016 Share Posted January 4, 2016 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 Link to comment Share on other sites More sharing options...
Martijn Geerts Posted January 4, 2016 Author Share Posted January 4, 2016 (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 January 4, 2016 by Martijn Geerts Link to comment Share on other sites More sharing options...
Sradesign Posted January 4, 2016 Share Posted January 4, 2016 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 Link to comment Share on other sites More sharing options...
Martijn Geerts Posted January 4, 2016 Author Share Posted January 4, 2016 You could use the whitelist then I guess... https://processwire.com/api/variables/input/ And again, use the wire() function call. BTW, thanks for using my Module... Link to comment Share on other sites More sharing options...
Sradesign Posted January 4, 2016 Share Posted January 4, 2016 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. Link to comment Share on other sites More sharing options...
Sradesign Posted January 4, 2016 Share Posted January 4, 2016 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 Link to comment Share on other sites More sharing options...
Martijn Geerts Posted January 4, 2016 Author Share Posted January 4, 2016 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. Link to comment Share on other sites More sharing options...
Sradesign Posted January 4, 2016 Share Posted January 4, 2016 Thanks Martijn look forward to see your solution. Link to comment Share on other sites More sharing options...
Martijn Geerts Posted January 5, 2016 Author Share Posted January 5, 2016 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'); 2 Link to comment Share on other sites More sharing options...
Sradesign Posted January 5, 2016 Share Posted January 5, 2016 ok let me try to see if it gives me the desired result. Link to comment Share on other sites More sharing options...
Sradesign Posted January 5, 2016 Share Posted January 5, 2016 Bravo that worked perfectly thank you very much again Martijn. 1 Link to comment Share on other sites More sharing options...
JasonS Posted March 4, 2016 Share Posted March 4, 2016 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? Link to comment Share on other sites More sharing options...
Martijn Geerts Posted March 4, 2016 Author Share Posted March 4, 2016 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. 1 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now