cakephp how to use Configure::read email.default.from code example
Example: cakephp send mail bcc
public function send($to_emails, $subject, $template, $data){
try{
$email = new CakeEmail('gmail');
$email->template($template)
->bcc($to_emails)
->viewVars($data)
->subject($subject);
$email->send();
return array(
'status' => true
);
} catch(SocketException $e) {
CakeLog::write($this->log_module,
"Send email to \"" . (is_array($to_emails) ? implode(', ', $to_emails) : $to_emails) . "\" with template \"" .
$template . "\" Failed because " . $e->getMessage());
return array(
'status' => false,
'message' => "Send email to \"" . (is_array($to_emails) ? implode(', ', $to_emails) : $to_emails) . "\" with template \"" .
$template . "\" Failed because " . $e->getMessage(),
'error_message' => $e->getMessage(),
);
}
}