mail() wrapper

The framework comes with a convenience wrapper for the PHP inbuilt mail() function. It can be used to use views with templating as mail content.

The following example demonstrates how to use the functionality


//Instantiate class instance
$mailer = new  Asatru\Mailwrapper\Mail();

//Here you set the recipient of the e-mail

//E-Mail subject
$mailer->setSubject('E-Mail subject');

//Specify a view
$mailer->setView('layout', array(array('yield', 'yieldfile')), [
    'some_var' => $some_value

//You can also optionally specify addition headers and parameters

$mailer->send(); //Send the e-mail
© 2021 by Daniel Brendel - all rights reserved