Chtml::link with domain howto

Hello Mates,

I tried to develop user registration functionality with mail confirmation. I have some troubles to generate and send the email content with link into it.

My code that generate link is:




if($confirm_record->save()) {

  $email = Yii::app()->email;

  $email->from = "admin@recepti.com";

  $email->to = $model->email;

  $email->subject = 'Email confirmation action';

  $email->message = 'click the following link '. 

  CHtml::link("click", array("users/mailconfirm", "uid" => $model->id, "hash" => $key));

  $email->send();

					

  $this->redirect(array('view','id'=>$model->id));

}



and the link I receive in the mail is:


http:// index.php/?r=users/mailconfirm&uid=33&hash=a918b5f23f3f2340ef2cc8a74c3f237f

How i may put the domain in the link?

Thanks in advance.

A. Marinov

Use CController.createAbsoluteUrl() method as a second CHtml.link() parameter.

Thanks !!!

Finally it looks like that:




$email->message = 'click the following link '.  

    	CHtml::link("click", $this->createAbsoluteUrl('users/mailconfirm', array('uid'=>$model->id, 'hash'=>$key), "http"));