Sending mails to mutliple recipients

Hi guys, I know how to program method in order to send mail to multiple recipients in Controller, but I don’t know where to get information about mail adresses. In my database,there is just one attribute, so I code like this in order to get one single adress of recipient:

<?= $form->field($model, 'mail_antwortadresse')->textInput(['value' => $zieladresse])->label('Zieladresse') ?>

I intend to set one more field called bb:

Multiple recipients should be provided by this field seperated by semicolon. Unfortunately, i don’t know how to integrate field bb: in my application. Following code throws out error

      <?= yii\widgets\ActiveField::textInput()->label('bb:') ?>

Any ideas, how to implement informations of multiple recipients given by formular?

right way do it is to add a virtual attribute in your model class

class EmailModel extend FormModel


    // add this property to you model like so

    public $bb;

    // ...


// and create a field for bb 

<?= $form->field($model, 'bb')->textInput()->label('bb:') ?>

don’t forget to mark bb as safe in your validation rules

[['bb'], 'safe']

Thx for this,but:

If I gonna marking bb as safe, I am not able to read in multiple recipients,which I intend to treat as an array, similar to this:

$extract_outer = explode("'", $model->bb);

$extract_inner = explode(";", $extract_outer[0]);

as soon I changed informations about recipients to an array, I intend sending mail in Controller itering about $extract_inner

Hope,my intention will do its job as planned. What do U think? I know, it’s to me validating informations transformed to an array using string functions of php…

by marking bb as safe should not change the value of it, it tells yii to let the value be set by mass assignment with method calls like


I don’t think its the validation maybe you can dump your $this->bb and see if the values match your input

Okay. So, I’ll do!

Thx for ur help…

P.S.: This thread can be closed as succesfully solved!