Namespaces

  • Latte
    • Loaders
    • Macros
    • Runtime
  • Nette
    • Application
      • Responses
      • Routers
      • UI
    • Bridges
      • ApplicationDI
      • ApplicationLatte
      • ApplicationTracy
      • CacheDI
      • CacheLatte
      • DatabaseDI
      • DatabaseTracy
      • DITracy
      • FormsDI
      • FormsLatte
      • Framework
      • HttpDI
      • HttpTracy
      • MailDI
      • ReflectionDI
      • SecurityDI
      • SecurityTracy
    • Caching
      • Storages
    • ComponentModel
    • Database
      • Conventions
      • Drivers
      • Reflection
      • Table
    • DI
      • Config
        • Adapters
      • Extensions
    • Diagnostics
    • Forms
      • Controls
      • Rendering
    • Http
    • Iterators
    • Latte
    • Loaders
    • Localization
    • Mail
    • Neon
    • PhpGenerator
    • Reflection
    • Security
    • Templating
    • Utils
  • NetteModule
  • none
  • Tracy
    • Bridges
      • Nette

Classes

  • MailExtension
  • Overview
  • Namespace
  • Class
  • Tree
  • Deprecated
 1: <?php
 2: 
 3: /**
 4:  * This file is part of the Nette Framework (http://nette.org)
 5:  * Copyright (c) 2004 David Grudl (http://davidgrudl.com)
 6:  */
 7: 
 8: namespace Nette\Bridges\MailDI;
 9: 
10: use Nette;
11: 
12: 
13: /**
14:  * Mail extension for Nette DI.
15:  *
16:  * @author     David Grudl
17:  * @author     Petr Morávek
18:  */
19: class MailExtension extends Nette\DI\CompilerExtension
20: {
21: 
22:     public $defaults = array(
23:         'smtp' => FALSE,
24:         'host' => NULL,
25:         'port' => NULL,
26:         'username' => NULL,
27:         'password' => NULL,
28:         'secure' => NULL,
29:         'timeout' => NULL,
30:     );
31: 
32: 
33:     public function loadConfiguration()
34:     {
35:         $container = $this->getContainerBuilder();
36:         $config = $this->validateConfig($this->defaults);
37: 
38:         $mailer = $container->addDefinition($this->prefix('mailer'))
39:             ->setClass('Nette\Mail\IMailer');
40: 
41:         if (empty($config['smtp'])) {
42:             $mailer->setFactory('Nette\Mail\SendmailMailer');
43:         } else {
44:             $mailer->setFactory('Nette\Mail\SmtpMailer', array($config));
45:         }
46: 
47:         if ($this->name === 'mail') {
48:             $container->addAlias('nette.mailer', $this->prefix('mailer'));
49:         }
50:     }
51: 
52: }
53: 
Nette 2.3.1 API API documentation generated by ApiGen 2.8.0