# email

Set options for Kirby's built-in email class

****

- Read more: <https://getkirby.com/docs/guide/emails>

****

## Email transport

```php
return [
  'email' => [
    'transport' => [
      'type' => 'smtp',
      'host' => 'smtp.company.com',
      'port' => 465,
      'security' => true
    ]
  ]
];
```

If `security` is set to `true`, Kirby automatically converts it to `'tls'` or `'ssl'` depending on the configured port. If no port is given and secure transport is enabled, the port is set to 587 (the common port for SMTP over TLS).

You can also use `'tls'` or `'ssl'` explicitly via the `security` key:

```php
return [
  'email' => [
    'transport' => [
      ...
      'port' => 587,
      'security' => 'tls'
    ]
  ]
];
```

### Email transport with authentication

```php
return [
  'email' => [
    'transport' => [
      'type' => 'smtp',
      'host' => 'smtp.server.com',
      'port' => 465,
      'security' => true,
      'auth' => true,
      'username' => '...',
      'password' => '...',
    ]
  ]
];
```

## Email presets

```php
return [
  'email' => [
    'presets' => [
      'contact' => [
        'from'    => 'no-reply@supercompany.com',
        'subject' => 'Thank you for your contact request',
        'cc'      => 'marketing@supercompany.com',
        'body'    => 'We will never reply'
      ]
    ]
  ]
];
````

Read the guide on <a href="https://getkirby.com/docs/guide/emails#presets">how to use email presets</a>.