Overview

Packages

  • CONTENIDO
  • Core
    • Authentication
    • Backend
    • Cache
    • CEC
    • Chain
    • ContentType
    • Database
    • Debug
    • Exception
    • Frontend
      • Search
      • URI
      • Util
    • GenericDB
      • Model
    • GUI
      • HTML
    • I18N
    • LayoutHandler
    • Log
    • Security
    • Session
    • Util
    • Validation
    • Versioning
    • XML
  • Module
    • ContentRssCreator
    • ContentSitemapHtml
    • ContentSitemapXml
    • ContentUserForum
    • NavigationTop
    • ScriptCookieDirective
  • mpAutoloaderClassMap
  • None
  • Plugin
    • ContentAllocation
    • CronjobOverview
    • FormAssistant
    • FrontendLogic
    • FrontendUsers
    • Linkchecker
    • ModRewrite
    • Newsletter
    • Repository
      • FrontendNavigation
      • KeywordDensity
    • SearchSolr
    • SmartyWrapper
    • UrlShortener
    • UserForum
    • Workflow
  • PluginManager
  • Setup
    • Form
    • GUI
    • Helper
      • Environment
      • Filesystem
      • MySQL
      • PHP
    • UpgradeJob
  • Smarty
    • Cacher
    • Compiler
    • Config
    • Debug
    • PluginsBlock
    • PluginsFilter
    • PluginsFunction
    • PluginsInternal
    • PluginsModifier
    • PluginsModifierCompiler
    • PluginsShared
    • Security
    • Template
    • TemplateResources
  • Swift
    • ByteStream
    • CharacterStream
    • Encoder
    • Events
    • KeyCache
    • Mailer
    • Mime
    • Plugins
    • Transport

Classes

  • Swift_FailoverTransport
  • Swift_LoadBalancedTransport
  • Swift_MailTransport
  • Swift_Plugins_Loggers_ArrayLogger
  • Swift_Plugins_Loggers_EchoLogger
  • Swift_SendmailTransport
  • Swift_SmtpTransport
  • Swift_Transport_AbstractSmtpTransport
  • Swift_Transport_Esmtp_Auth_CramMd5Authenticator
  • Swift_Transport_Esmtp_Auth_LoginAuthenticator
  • Swift_Transport_Esmtp_Auth_PlainAuthenticator
  • Swift_Transport_Esmtp_AuthHandler
  • Swift_Transport_EsmtpTransport
  • Swift_Transport_FailoverTransport
  • Swift_Transport_LoadBalancedTransport
  • Swift_Transport_MailTransport
  • Swift_Transport_SendmailTransport
  • Swift_Transport_SimpleMailInvoker
  • Swift_Transport_StreamBuffer

Interfaces

  • Swift_Plugins_Logger
  • Swift_Plugins_Pop_Pop3Exception
  • Swift_Transport
  • Swift_Transport_Esmtp_Authenticator
  • Swift_Transport_EsmtpHandler
  • Swift_Transport_IoBuffer
  • Swift_Transport_MailInvoker
  • Swift_Transport_SmtpAgent
  • Swift_TransportException
  • Overview
  • Package
  • Function
  • Todo
  • Download
  1: <?php
  2: 
  3: /*
  4:  * This file is part of SwiftMailer.
  5:  * (c) 2004-2009 Chris Corbyn
  6:  *
  7:  * For the full copyright and license information, please view the LICENSE
  8:  * file that was distributed with this source code.
  9:  */
 10: 
 11: /**
 12:  * Swift Mailer class.
 13:  *
 14:  * @package Swift
 15:  * @author Chris Corbyn
 16:  */
 17: class Swift_Mailer
 18: {
 19:     /** The Transport used to send messages */
 20:     private $_transport;
 21: 
 22:     /**
 23:      * Create a new Mailer using $transport for delivery.
 24:      *
 25:      * @param Swift_Transport $transport
 26:      */
 27:     public function __construct(Swift_Transport $transport)
 28:     {
 29:         $this->_transport = $transport;
 30:     }
 31: 
 32:     /**
 33:      * Create a new Mailer instance.
 34:      *
 35:      * @param  Swift_Transport $transport
 36:      * @return Swift_Mailer
 37:      */
 38:     public static function newInstance(Swift_Transport $transport)
 39:     {
 40:         return new self($transport);
 41:     }
 42: 
 43:     /**
 44:      * Create a new class instance of one of the message services
 45:      * For example 'mimepart' would create a 'message.mimepart' instance
 46:      *
 47:      * @param  string $service
 48:      * @return object
 49:      */
 50:     public function createMessage($service = 'message')
 51:     {
 52:         return Swift_DependencyContainer::getInstance()
 53:             ->lookup('message.'.$service);
 54:     }
 55: 
 56:     /**
 57:      * Send the given Message like it would be sent in a mail client.
 58:      *
 59:      * All recipients (with the exception of Bcc) will be able to see the other
 60:      * recipients this message was sent to.
 61:      *
 62:      * Recipient/sender data will be retrieved from the Message object.
 63:      *
 64:      * The return value is the number of recipients who were accepted for
 65:      * delivery.
 66:      *
 67:      * @param Swift_Mime_Message $message
 68:      * @param array &$failedRecipients, optional
 69:      * @return int
 70:      */
 71:     public function send(Swift_Mime_Message $message, &$failedRecipients = null)
 72:     {
 73:         $failedRecipients = (array) $failedRecipients;
 74: 
 75:         if (!$this->_transport->isStarted()) {
 76:             $this->_transport->start();
 77:         }
 78: 
 79:         $sent = 0;
 80: 
 81:         try {
 82:             $sent = $this->_transport->send($message, $failedRecipients);
 83:         } catch (Swift_RfcComplianceException $e) {
 84:             foreach ($message->getTo() as $address => $name) {
 85:                 $failedRecipients[] = $address;
 86:             }
 87:         }
 88: 
 89:         return $sent;
 90:     }
 91: 
 92:     /**
 93:      * Register a plugin using a known unique key (e.g. myPlugin).
 94:      *
 95:      * @param Swift_Events_EventListener $plugin
 96:      * @param string                     $key
 97:      */
 98:     public function registerPlugin(Swift_Events_EventListener $plugin)
 99:     {
100:         $this->_transport->registerPlugin($plugin);
101:     }
102: 
103:     /**
104:      * The Transport used to send messages.
105:      * @return Swift_Transport
106:      */
107:     public function getTransport()
108:     {
109:         return $this->_transport;
110:     }
111: }
112: 
CMS CONTENIDO 4.9.7 API documentation generated by ApiGen