Echo $site->url inside Email param

Hello,
I’m using

$email = email(array(
  'to'      => 'bastian@getkirby.com',
  'from'    => 'my@email.com',
  '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();
}

to send an E-mail to me. With this I know that somebody is editing my website.
Is there a way to echo the page name like<?= $site->url ?>inside the subject? So I know which page is edited.

Thanks in advance,
Erik

This should work:

$pagename = $site->url();
$email = email(array(
  'to'      => 'bastian@getkirby.com',
  'from'    => 'my@email.com',
  'subject' => 'Sending emails with Kirby is easy' . $pagename,
  'body'    => 'Hey! This was really easy!'
));
1 Like