Skip to content

Kirby 3.6.6

email

Set options for Kirby's built-in email class

Email presets

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'
      ]
    ]
  ]
];

Email transport

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:

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

Email transport with authentication

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