Closed flopperj closed 3 years ago
Thanks for the suggestion!
Personally, I prefer invoking view rendering inside an output buffer, and passing that to PHPMailer. It's a looser coupling, and PHPMailer is one of the biggest/best.
On Wed, 11 Aug 2021 at 07:03, James Arama @.***> wrote:
Hello,
I use the wp-mvc plugin for some projects and I wanted to share a thought here. I think it'd be cool to have an email helper within the mvc framework that we could use to setup email templates with. It'd be similar to what CakePhp has.
Sample setup:
// YourController.php
.....
$this->load_helper('Email'); $this->email->to = 'to_email_address'; $this->email->cc = ['list_of_email_addresses_to_cc']; $this->email->bcc = ['list_of_email_addresses_to_bcc']; $this->email->from = 'From Name
'; $this->email->reply_to = 'email_address_to_reply_to'; $this->email->subject = 'Your subject'; $this->email->template = 'path/to/template'; $this->email->layout = 'path/to/layout'; $this->email->send_as = 'html'; // text, html, or both
$this->email->set_vars([ 'var1' => $var1, 'var2' => $var2, 'var3' => $var3 ]);
// send the email $this->email->send();
.....
I can take a stab at this if anyone would find the helper useful to have.
-- cheers
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/tombenner/wp-mvc/issues/258, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAFJLZO2BUAZAAH7PEICTF3T4IHDFANCNFSM5B5SZU4Q . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email .
@cyberscribe - Interesting, I actually haven't played around with PHPMailer, thanks for sharing that. Will try it out.
Hello,
I use the wp-mvc plugin for some projects and I wanted to share a thought here. I think it'd be cool to have an email helper within the mvc framework that we could use to setup email templates with. It'd be similar to what CakePhp has.
Sample setup:
I can take a stab at this if anyone would find the helper useful to have.
-- cheers