Contact form change from

Hello,

iam searching for a solution, where i can change the from and to in contact controller.

      $email = email(array(
        'to'      => 'mail@xyz.com',
        'from'    => 'mail@xyz.com',
        'subject' => 'New project request',
        'replyTo' => $data['email'],
        'body'    => $body
      ));

So i have a dropdown and depending on the selection,
the submission should go to a other email.

How can i add multiple receiver? Please help

Thank texnixe for your fast response, maybe my request wasΒ΄t right, so i search for a way where the user can select where the email should go.

For example:

if dropdown value 1 = to email1
if dropdown value 2 = to email2

is this possible?

Use a variable:

$recipient = $page->recipient();
$email = email(array(
        'to'      => $recipient,
        'from'    => 'mail@xyz.com',
        'subject' => 'New project request',
        'replyTo' => $data['email'],
        'body'    => $body
      ));

i try this but alway it sent the mail to the first value, why this happens?


<select name="betreff"  id="betreff" onchange="GetSelectedTextValue(this)">
						   	<option value="mail@xy.com">Bewerber</option>
						   	<option value="mail@ab.com">Unternehmen</option>
		   				</select>

Oh sorry, it’a a form. The you have to get the value via get() in you controller or wherever you are handling the form.

$recipient = get('betreff');