我的代码在这里......
public function sendemail(){
$this->loadmodel('Template');
$this->Template->recursive = -1;
$temp = $this->Template->find('all',array('order'=>'rand()','limit'=>20));
$this->Employe->recursive = -1;
$person = $this->Employe->find('all',array('conditions'=>array('DAY(Employe.dob)' => date('d'),'MONTH(Employe.dob)' => date('m'))));
$count = count($person);
if(!empty($person)){
for($i=0; $i<=($count-1); $i++)
{
$template = $temp[$i]['Template']['description'];
$find = array("Name", "test1", "test2" ,"test3");
$replace = array($person[$i]['Employe']['name'], $person[$i]['Employe']['skype'], $person[$i]['Employe']['email'],$person[$i]['Employe']['gender']);
$template = str_replace($find, $replace ,$template);
$email = new CakeEmail();
$email->config('smtp');
$email->from(array('hris@planetwebsolution.com' => 'HR, Planet Web Solution'));
$email->to(array('hr@planetwebsolution.com'));
$email->emailFormat('html');
$email->subject('HAPPY BIRTHDAY '.$person[$i]['Employe']['name'].'....');
$bodyText= $template;
$email->send($bodyText);
unset($email);
}
}
return $this->redirect(array('controller' => 'staticpages', 'action' => 'index'));
}
当我点击sendemail功能时,它应该进入http://example.com/staticpages/index,但它显示带有此网址的空白页面。 http://example.com/staticpages/sendemail
任何人都可以帮助我吗? 提前谢谢..