I have an online leave application form which i have some fields and i can create,view and modify that leave form. I also want to do one more thing. whatever values am giving for all those fields like leave type,number of days, reason etc. Just i want to fetch all those values and i want to send it in mail.. In create form i will give values for all the fields.. When i click create button it should send an email with those details..

Here is my controller code for actionCreate. Here i have doubt in this line =>$mailmsg = (array('id'=>$model->leave\_id));

```
public function actionCreate()
   {
    $model=new EmpLeave;
            $model->dateof_leave = date("Y-m-d H:i");
    if(isset($_POST['EmpLeave']))
    {
        $model->attributes=$_POST['EmpLeave'];
        if($model->save())
                        $recipients = "sridhar.venkatesan53@gmail.com";
                        $headers["From"] = "noreply@elixir.in";
                        $headers["To"] = "sridhar.venkatesan53@gmail.com";
                        $headers["Subject"] = "User feedback";
                        $mailmsg = (array('id'=>$model->leave_id));
                        /* SMTP server name, port, user/passwd */
                        $smtpinfo["host"] = "smtp.mandrillapp.com";
                        $smtpinfo["port"] = "587";
                        $smtpinfo["auth"] = true;
                        $smtpinfo["username"] = "noreply@elixir.in";
                        $smtpinfo["password"] = "oNkeBOEA5MfaN_24loUs1w";
                        /* Create the mail object using the Mail::factory method */
                        $mail_object =& Mail::factory("smtp", $smtpinfo);
                        /* Ok send mail */
                        $mail_object->send($recipients, $headers, $mailmsg);
            $this->redirect(array('view','id'=>$model->leave_id));
    }
    $this->render('create',array(
        'model'=>$model,
    ));
}

```

This is my view.php

```
<?php $this->widget('zii.widgets.CDetailView', array(
'data'=>$model,
'attributes'=>array(
    'leave_id',
    'leave_type',
    'leave_reason',
    'numof_days',
    'type',
            'dateof_leave',
   ),
 )); ?>

```