PHP Класс AcMailer\Service\MailService

Автор: Alejandro Celaya Alastrué
Наследование: implements AcMailer\Service\MailServiceInterface, implements Zend\EventManager\EventManagerAwareInterface, implements AcMailer\Event\MailListenerAwareInterface
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
__construct ( Zend\Mail\Message $message, Zend\Mail\Transport\TransportInterface $transport, Zend\View\Renderer\RendererInterface $renderer ) Creates a new MailService
addAttachment ( string $path, string | null $filename = null )
addAttachments ( array $paths )
attachMailListener ( AcMailer\Event\MailListenerInterface $mailListener, integer $priority = 1 ) : mixed | void Attaches a new MailListenerInterface
detachMailListener ( AcMailer\Event\MailListenerInterface $mailListener ) Detaches provided MailListener
getAttachments ( ) : array Returns the list of attachments
getEventManager ( ) : Zend\EventManager\EventManagerInterface Retrieve the event manager Lazy-loads an EventManager instance if none registered.
getMessage ( ) : Zend\Mail\Message Returns this service's message
getRenderer ( ) : Zend\View\Renderer\RendererInterface Returns the renderer object that will be used to render templates
getTransport ( ) : Zend\Mail\Transport\TransportInterface Returns the transport object that will be used to send the wrapped message
send ( ) : AcMailer\Result\ResultInterface Sends the mail
setAttachments ( array $paths )
setBody ( Zend\Mime\Part | Zend\Mime\Message | string $body, string $charset = null ) Sets the message body
setDefaultLayout ( AcMailer\View\DefaultLayoutInterface $layout = null ) : mixed Sets the default layout to be used with all the templates set when calling setTemplate.
setEventManager ( Zend\EventManager\EventManagerInterface $events ) Inject an EventManager instance
setRenderer ( Zend\View\Renderer\RendererInterface $renderer )
setSubject ( string $subject ) Sets the message subject
setTemplate ( string | Zend\View\Model\ViewModel $template, array $params = [] ) Sets the body of this message from a template
setTransport ( Zend\Mail\Transport\TransportInterface $transport )

Защищенные методы

Метод Описание
attachFiles ( ) Attaches files to the message if any
createMailEvent ( string $name = MailEvent::EVENT_MAIL_PRE_SEND, AcMailer\Result\ResultInterface $result = null ) : AcMailer\Event\MailEvent Creates a new MailEvent object
createMailResultFromException ( Exception $e ) : AcMailer\Result\MailResult Creates a error MailResult from an exception
renderChildren ( Zend\View\Model\ViewModel $model ) Renders template childrens.

Описание методов

__construct() публичный Метод

Creates a new MailService
public __construct ( Zend\Mail\Message $message, Zend\Mail\Transport\TransportInterface $transport, Zend\View\Renderer\RendererInterface $renderer )
$message Zend\Mail\Message
$transport Zend\Mail\Transport\TransportInterface
$renderer Zend\View\Renderer\RendererInterface Renderer used to render templates, typically a PhpRenderer

addAttachment() публичный Метод

public addAttachment ( string $path, string | null $filename = null )
$path string
$filename string | null

addAttachments() публичный Метод

public addAttachments ( array $paths )
$paths array

attachFiles() защищенный Метод

Attaches files to the message if any
protected attachFiles ( )

attachMailListener() публичный Метод

Attaches a new MailListenerInterface
public attachMailListener ( AcMailer\Event\MailListenerInterface $mailListener, integer $priority = 1 ) : mixed | void
$mailListener AcMailer\Event\MailListenerInterface
$priority integer
Результат mixed | void

createMailEvent() защищенный Метод

Creates a new MailEvent object
protected createMailEvent ( string $name = MailEvent::EVENT_MAIL_PRE_SEND, AcMailer\Result\ResultInterface $result = null ) : AcMailer\Event\MailEvent
$name string
$result AcMailer\Result\ResultInterface
Результат AcMailer\Event\MailEvent

createMailResultFromException() защищенный Метод

Creates a error MailResult from an exception
protected createMailResultFromException ( Exception $e ) : AcMailer\Result\MailResult
$e Exception
Результат AcMailer\Result\MailResult

detachMailListener() публичный Метод

Detaches provided MailListener
public detachMailListener ( AcMailer\Event\MailListenerInterface $mailListener )
$mailListener AcMailer\Event\MailListenerInterface

getAttachments() публичный Метод

Returns the list of attachments
public getAttachments ( ) : array
Результат array

getEventManager() публичный Метод

Retrieve the event manager Lazy-loads an EventManager instance if none registered.
public getEventManager ( ) : Zend\EventManager\EventManagerInterface
Результат Zend\EventManager\EventManagerInterface

getMessage() публичный Метод

Returns this service's message
См. также: AcMailer\Service\MailServiceInterface::getMessage()
public getMessage ( ) : Zend\Mail\Message
Результат Zend\Mail\Message

getRenderer() публичный Метод

Returns the renderer object that will be used to render templates
public getRenderer ( ) : Zend\View\Renderer\RendererInterface
Результат Zend\View\Renderer\RendererInterface

getTransport() публичный Метод

Returns the transport object that will be used to send the wrapped message
public getTransport ( ) : Zend\Mail\Transport\TransportInterface
Результат Zend\Mail\Transport\TransportInterface

renderChildren() защищенный Метод

Inspired on Zend\View\View implementation to recursively render child models
См. также: Zend\View\View::renderChildren
protected renderChildren ( Zend\View\Model\ViewModel $model )
$model Zend\View\Model\ViewModel

send() публичный Метод

Sends the mail
public send ( ) : AcMailer\Result\ResultInterface
Результат AcMailer\Result\ResultInterface

setAttachments() публичный Метод

public setAttachments ( array $paths )
$paths array

setBody() публичный Метод

Sets the message body
См. также: AcMailer\Service\MailServiceInterface::setBody()
public setBody ( Zend\Mime\Part | Zend\Mime\Message | string $body, string $charset = null )
$body Zend\Mime\Part | Zend\Mime\Message | string Email body
$charset string

setDefaultLayout() публичный Метод

Sets the default layout to be used with all the templates set when calling setTemplate.
public setDefaultLayout ( AcMailer\View\DefaultLayoutInterface $layout = null ) : mixed
$layout AcMailer\View\DefaultLayoutInterface
Результат mixed

setEventManager() публичный Метод

Inject an EventManager instance
public setEventManager ( Zend\EventManager\EventManagerInterface $events )
$events Zend\EventManager\EventManagerInterface

setRenderer() публичный Метод

public setRenderer ( Zend\View\Renderer\RendererInterface $renderer )
$renderer Zend\View\Renderer\RendererInterface

setSubject() публичный Метод

Sets the message subject
Устаревший: Use $mailService->getMessage()->setSubject() instead
public setSubject ( string $subject )
$subject string The subject of the message

setTemplate() публичный Метод

Sets the body of this message from a template
См. также: AcMailer\Service\MailServiceInterface::setTemplate()
public setTemplate ( string | Zend\View\Model\ViewModel $template, array $params = [] )
$template string | Zend\View\Model\ViewModel
$params array

setTransport() публичный Метод

public setTransport ( Zend\Mail\Transport\TransportInterface $transport )
$transport Zend\Mail\Transport\TransportInterface