This should probably be in the controller:
class UsersController extends AppController {
var $name = 'Users';
var $helpers = array('Html');
var $components = array('Email');
function _email($email_user, $code){
$pwrurl = "http://xxx/users?se=check&mail=".$email_user."&code=".$code;
$this->Email->from = 'From: Someone';
$this->Email->to = $email_user;
$this->Email->subject = 'Your Subject';
$this->Email->sendAs = 'html';
$this->Email->template = 'your_template';
$this->set('pwrurl', $pwrurl);
$this->Email->send();
}
}
Then create an email template in the / elements / email / html views, named just like your template in the above code. For this example, your_template.ctp. Compose the message the way you want, and wherever you want the link to appear:
$this->Html->link('Link name', $pwrurl, array('target' => '_blank'));
Hope this helps.
source
share