# Mailer

Lazy sending mailer with template rendering and dev output

author | Lukas Korinek
package | Default

### Methods

## __construct

    __construct(\Symfony\Component\HttpFoundation\RequestStack $stack, \Swift_Mailer $swift, \Symfony\Component\Templating\EngineInterface $twig, array $mailSubjectTranslations, string $locale, string $mailOutputPath, string $mailFrom)

### Arguments

#### $stack

`\Symfony\Component\HttpFoundation\RequestStack`

#### $swift

`\Swift_Mailer`

#### $twig

`\Symfony\Component\Templating\EngineInterface`

#### $mailSubjectTranslations

`array`

#### $locale

`string`

Default application locale

#### $mailOutputPath

`string`

Path to a temporary folder for sent mails storage

#### $mailFrom

`string`

Sender email address for the app

## Clears all pending mails from memory

    clear()

## Checks if there are any mails waiting to be sent

    has() : boolean

### Response

`boolean`

## Creates a mail and stores it in memory

    mail(string $recipient, string $subject, string $template, string $data)

### Arguments

#### $recipient

`string`

Address to which the email should be sent

#### $subject

`string`

Email subject - nonlocalised, see config for subject translations

#### $template

`string`

Twig template to use

#### $data

`string`

Data to be added into twig template

## Sends an individual email

    send(array $mail)

### Arguments

#### $mail

`array`

Memory mail data

## Commits all mails and sends them

    sendAll()

### Properties

## swift

    swift : \Swift_Mailer

var |

### Type(s)

`\Swift_Mailer`

## twig

    twig : \Symfony\Component\Templating\EngineInterface

var |

### Type(s)

`\Symfony\Component\Templating\EngineInterface`

## outputPath

    outputPath : string

var |

### Type(s)

`string`

## mailFrom

    mailFrom : string

var |

### Type(s)

`string`

## mailSubjectTranslations

    mailSubjectTranslations : array

var |

### Type(s)

`array`

## memory

    memory : array

var |

### Type(s)

`array`

## locale

    locale : string

var |

### Type(s)

`string`