Raitis Stengrevics wrote on Monday 30th of May 2011:Is there any progress yet? Is someone creating something? If not... I could give a shot. x)
Email::factory() ->subject('test sub') //->from('info@invista.lt') ->to('info@invista.lt') ->message('message') ->set_alt_message('message txt') ->send(); Email::print_debugger();
<?php /** * Fuel is a fast, lightweight, community driven PHP5 framework. * * @package Fuel * @version 1.0 * @author Fuel Development Team * @license MIT License * @copyright 2010 - 2011 Fuel Development Team * @link http://fuelphp.com */ require_once __DIR__.'/lib/swift_required.php'; /* End of file bootstrap.php */
'packages' => array( 'auth', 'swift' //'orm', ),
class Controller_Testmail extends Controller { /** * The index action. * * @access public * @return void */ public function action_index() { $Transport = Swift_MailTransport::newInstance(); $Mailer = Swift_Mailer::newInstance($Transport); $message = Swift_Message::newInstance() //Give the message a subject ->setSubject('Test subject') //Set the From address with an associative array ->setFrom(array('local1@localhost.com' => 'Local1 Localhost')) //Set the To addresses with an associative array ->setTo(array('info@localhost.com' => 'Test Name')) //Give it a body ->setBody('Here is the message itself') //And optionally an alternative body ->addPart('<p style="color: #336699;"><q>Here is the message itself in it\'s various guises</q></p>', 'text/html') //Optionally add any attachments //->attach(Swift_Attachment::fromPath('my-document.pdf')) ; $Mailer->send($message); $this->response->body = View::factory('welcome/index'); } }
class Controller_Testmail extends Controller { public function action_index() { $email = new \Email\Email::factory('swift'); // assume the package is called 'Email' // use generic methods here $email ->subject('Test subject') ->from(array('local1@localhost.com' => 'Local1 Localhost')) ->to(array('info@localhost.com' => 'Test Name')) ->body('Here is the message itself') ->part('<p style="color: #336699;"><q>Here is the message itself in it\'s various guises</q></p>', 'text/html'); // add an attachment $email->attach('my-document.pdf')); // send the message if ($result = $email->send()) { // successfully send } else { // process the error } }It will allow you to swap the swift driver by any other driver, which doesn't even have to send out a real email (it could generate a forum post somewhere for example), which gives you total flexibility, fuel style. See Jelmer's fuel-parser as a good example of how to set something like this up (or checkout the old Email class)...
It looks like you're new here. If you want to get involved, click one of these buttons!