Sends an email

  • $params (array)
  • return ($email)


$email = email(array(
  'to'      => '',
  'from'    => '',
  'subject' => 'Sending emails with Kirby is easy',
  'body'    => 'Hey! This was really easy!'

if($email->send()) {
  echo 'The email has been sent';
} else {
  echo $email->error();

Set email options

You can set default email options in your config.php

c::set('email.service', 'mail');
c::set('email.from', 'Bastian Allgeier <>');
c::set('email.replyTo', 'Bastian Allgeier <>');
c::set('email.subject', 'Kirby Support');

You can then send emails in your templates, controllers, snippets etc. with those default settings:

  'to'   => '',
  'body' => 'Hey Peter!'

Is something missing or incorrect? Edit this page on Github…