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
    • Forms
      • Controls
      • Rendering
    • Http
    • Iterators
    • Loaders
    • Localization
    • Mail
    • Neon
    • PhpGenerator
    • Reflection
    • Security
    • Utils
  • none
  • Tracy
    • Bridges
      • Nette

Classes

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