KnpLabs/KnpRadBundle — pull request #37 by everzet (2012-12-28 10:50:21+00:00)
Title: Mailer message factory

Adds shorthand `sendMessage($from, $to, $name, $parameters)` method to the base controller. Where `$from` - sender address, `$to` - recipient address, `$name` is short name of the mail template and `$parameters` are parameters for that template.

If you'll do something like:

``` php
$this->sendMessage('server@knplabs.com', 'konstantin.kudryashov@knplabs.com', 'contact');
```

Mailer factory will:

1. Find `App:Mails:contact.txt.twig` template (if exists) and load `subject` & `body` blocks from it as mail body and subject
2. Find `App:Mails:contact.html.twig` template (if exists) and load its `body` into html part of the message (multibody message)
3. Set `from` to "server@knplabs.com"
4. Set `to` to "konstantin.kudryashov@knplabs.com"
5. Send an email with current DIC mailer