Multiple email recipients in uniform

In @mzur 's Uniform, is it possible to provide more than one email to send the message to ? an array does not seem to work:

		$form->emailAction([
			'to' => [ 'email1@gmail.com', 'email2@gmail.com' ],
			'from' => 'this@mail.com',
		]);		

Additionally I will attempt to extract the recipients from panel fields, I assume that will be straight-forward.

Thank you

You can add any number of emailActions() each with a different set of parameters.

1 Like

You can chain multiple mailActions(), just like you would do with Kirby methods:

  if (r::is('POST')) {
    $form->emailAction([
      'to' => 'email1@example.com',
      'from' => 'test@example.com',
      'subject' => 'New contact : {name}'
    ])
    ->emailAction([
      'to' => 'email2@example.com',
      'from' => 'test@example.com',
      'subject' => 'New contact : {name}'
    ]);
  }
1 Like

Great, thank you both.

Nevertheless I am thinking, this will send two different emails, right?

Shouldn’t there be an option to send one email to both recipients, say as a CC ?

Thanks again.

You could create a custom action.

That would indeed require a custom action. But it’s trivial to add to the default action. Care to make a pull request on GitHub? :wink:

That would actually be my first pull request on github :sweat_smile: which would be lovely, I will gie it a go as soon as I can if it is still there.

Thank you

1 Like