/** * Prepares the data array. * Adds headers and content * * @return void */ protected function _prepareData() { $this->_data = array(); if (count($this->_cakeEmail->cc()) > 0) { throw new CakeException('Postageapp transport does not support cc'); } if (count($this->_cakeEmail->bcc()) > 0) { throw new CakeException('Postageapp transport does not support bcc'); } if (count($this->_cakeEmail->sender()) > 0) { throw new CakeException('Postageapp transport does not support sender'); } $headers = $this->_cakeEmail->getHeaders(array('from', 'sender', 'replyTo', 'returnPath', 'to', 'subject')); $this->_data['recipients'] = $headers['To']; $map = array('From', 'Subject', 'Reply-To', 'X-Mailer', 'MIME-Version', 'Content-Transfer-Encoding'); foreach ($map as $header) { if (!empty($headers[$header])) { $this->_addHeader($header, $headers[$header]); } } $emailFormat = $this->_cakeEmail->emailFormat(); if ($emailFormat == 'both' || $emailFormat == 'text') { $this->_data['content']['text/plain'] = $this->_cakeEmail->message('text'); } if ($emailFormat == 'both' || $emailFormat == 'html') { $this->_data['content']['text/html'] = $this->_cakeEmail->message('html'); } }
private function __sendReminderMail($email_address) { $from = Configure::read('RentSquare.supportemail'); $email = new CakeEmail(); $email->domain('rentsquaredev.com'); $email->sender('*****@*****.**', 'RentSquare Support'); $email->template('reminder', 'generic')->emailFormat('html')->from(array($from => 'RentSquare Support'))->to($email_address)->subject('RentSquare Signup Reminder')->send(); return true; }
private function __sendPaymentSuccess($email_address, $email_data) { $from = Configure::read('RentSquare.supportemail'); $email = new CakeEmail(); $email->config('default'); $email->domain('rentsquaredev.com'); $email->sender('*****@*****.**', 'RentSquare Support'); $email->template('monthlyfeesuccess', 'generic')->emailFormat('html')->from(array($from => 'RentSquare Support'))->to($email_address)->subject('RentSquare Payment Receipt')->viewVars(array('email_data' => $email_data))->send(); return true; }
public function emailResetToken($email, $resetCode) { $host = isset($_SERVER["HTTP_HOST"]) ? $_SERVER["HTTP_HOST"] : ""; $url = Router::url("/users/password_reset/{$resetCode}", true); $Email = new CakeEmail(); $Email->from(["no-reply@{$host}" => $host]); $Email->to($email); $Email->sender("no-reply@{$host}", $host); $Email->subject("{$host} password reset."); return $Email->send("Hello, \n\nPlease use the link below to reset your password for {$host}\n\n{$url}\n\nWith regards, \n{$host}"); }
public function main() { $email = new CakeEmail(); $email->config(array('transport' => 'AmazonSESTransport.AmazonSES', 'log' => true, 'Amazon.SES.Key' => Configure::read('Amazon.SES.Key'), 'Amazon.SES.Secret' => Configure::read('Amazon.SES.Secret'))); $email->sender('*****@*****.**'); $email->from('*****@*****.**', 'Example'); $email->to('*****@*****.**'); $email->bcc('*****@*****.**'); $email->subject('SES Test from CakePHP'); $res = $email->send('test message.'); var_dump($res); }
private function __SendContactUsEmail($data) { $from = Configure::read('RentSquare.supportemail'); try { $email = new CakeEmail(); $email->domain('rentsquaredev.com'); $email->sender('*****@*****.**', 'RentSquare Support'); $email->template('contactus', 'generic')->emailFormat('html')->from(array($from => 'RentSquare Support'))->to('*****@*****.**')->subject('RentSquare Inquiry')->viewVars(array('data' => $data))->send(); } catch (Exception $e) { return false; } return true; }
/** * Send * * A bit of a misnomer, because this actually just adds it to a CakeResque * queue. The actual sending of the email will be performed later by a worker. * * @params CakeEmail $email * @return array */ public function send(CakeEmail $email) { // Take a copy of the existing configuration. $config = array('headers' => $email->getHeaders(), 'from' => $email->from(), 'sender' => $email->sender(), 'replyTo' => $email->replyTo(), 'readReceipt' => $email->readReceipt(), 'returnPath' => $email->returnPath(), 'to' => $email->to(), 'cc' => $email->cc(), 'bcc' => $email->bcc(), 'subject' => $email->subject(), 'viewRender' => $email->viewRender(), 'viewVars' => $email->viewVars(), 'emailFormat' => $email->emailFormat(), 'messageId' => $email->messageId(), 'attachments' => $email->attachments()); // unset($config['config']['transport']); $template = $email->template(); $config['template'] = $template['template']; $config['layout'] = $template['layout']; // Clean it up to avoid errors. $config = array_filter($config, function ($v) { return (bool) $v; }); debug($config); // Include a message, if they sent one via plain text. $message = $email->message(CakeEmail::MESSAGE_HTML) ? null : $email->message(CakeEmail::MESSAGE_TEXT); // Drop it in a queue. Resque::enqueue('email', 'ResqueEmail.EmailShell', array('send', $config, $message)); return array('headers' => $email->getHeaders(), 'message' => $email->message()); }
public function sendForgetPassMail($useremail, $userName, $userId, $fullName, $pass) { $email = new CakeEmail('smtp'); $email->sender('*****@*****.**'); $email->to($useremail); $email->emailFormat('html'); $email->subject('Forget Password Mail'); $body = " "; $body .= " Full Name : " . $fullName . '<br/>' . ' Email : ' . $userName . '<br/> Password : '******'<br />'; $body .= "Please Click on following link to login <br />"; $body .= '<a href="http://projects.udaantechnologies.com/yumplate/">Login link</a>'; try { $result = $email->send($body); } catch (Exception $ex) { // we could not send the email, ignore it return false; } return true; }
public function forgottenPassword($email) { if ($client = $this->Client->findByEmail($email)) { $client['Client']['token_password'] = sha1(rand(0, 154896258952)); if ($this->Client->save($client)) { $message = 'Un email va vous être envoyer pour changer votre mot de passe'; $Email = new CakeEmail(); $Email->config('default'); $Email->emailFormat('html'); $Email->template('newpassword'); $Email->viewVars(array('value' => $client['Client']['token_password'])); $Email->from('*****@*****.**'); $Email->sender('*****@*****.**', 'MyApp emailer'); $Email->to($client['Client']['email']); $Email->subject('Change your password'); $Email->send(); } } else { $message = 'Erreur, impossible d\'effectuer l\'action ' . $email; } $this->set(array('message' => $message, '_serialize' => array('message'))); }
/** * Used to send change password mail to user * * @access public * @param array $user user detail * @return void */ public function sendChangePasswordMail($user) { $userId = $user['User']['id']; $email = new CakeEmail(); $fromConfig = EMAIL_FROM_ADDRESS; $fromNameConfig = EMAIL_FROM_NAME; $email->from(array($fromConfig => $fromNameConfig)); $email->sender(array($fromConfig => $fromNameConfig)); $email->to($user['User']['email']); $email->subject(SITE_NAME . ': Change Password Confirmation'); $body = "Hey " . $user['User']['first_name'] . ", You recently changed your password on " . date('Y M d h:i:s', time()) . ".\n\nAs a security precaution, this notification has been sent to your email addresse associated with your account.\n\nThanks,\n" . SITE_NAME; try { $result = $email->send($body); } catch (Exception $ex) { // we could not send the email, ignore it $result = "Could not send change password email to userid-" . $userId; $this->log($result, LOG_DEBUG); } }
private function __sendMaintenanceNotification($data, $user_details, $ticket_id) { $from = Configure::read('RentSquare.supportemail'); $emailTo = ""; foreach ($user_details as $property_manager) { $emailTo = $property_manager['Property']['Manager']['email'] . ', '; } $emailTo = rtrim($emailTo, ', '); try { $email = new CakeEmail(); $email->domain('rentsquaredev.com'); $email->sender('*****@*****.**', 'RentSquare Support'); $email->template('newmaintenance', 'generic')->emailFormat('html')->from(array($from => 'RentSquare Support'))->to($emailTo)->subject('New Maintenance Ticket - RentSquare')->viewVars(array('data' => $data, 'user_details' => $user_details, 'ticket_id' => $ticket_id))->send(); } catch (Exception $e) { return false; } return true; }
/** * Used to send forgot password mail to user * * @access public * @param array $user user detail * @return void */ public function forgotPassword($user) { $userId = $user['User']['id']; $email = new CakeEmail(); $fromConfig = EMAIL_FROM_ADDRESS; $fromNameConfig = EMAIL_FROM_NAME; $email->from(array($fromConfig => $fromNameConfig)); $email->sender(array($fromConfig => $fromNameConfig)); $email->to($user['User']['email']); $email->subject(EMAIL_FROM_NAME . ': Request to Reset Your Password'); $activate_key = $this->getActivationKey($user['User']['password']); $link = Router::url("/activatePassword?ident={$userId}&activate={$activate_key}", true); $body = "Welcome " . $user['User']['first_name'] . ", let's help you get signed in\n\nYou have requested to have your password reset on " . EMAIL_FROM_NAME . ". Please click the link below to reset your password now :\n\n" . $link . "\n\n\nIf above link does not work please copy and paste the URL link (above) into your browser address bar to get to the Page to reset password\n\nChoose a password you can remember and please keep it secure.\n\nThanks,\n" . EMAIL_FROM_NAME; try { $result = $email->send($body); } catch (Exception $ex) { // we could not send the email, ignore it $result = "Could not send forgot password email to userid-" . $userId; } $this->log($result, LOG_DEBUG); }
/** * Used to send forgot password mail to user * * @access public * @param array $user user detail * @return void */ public function forgotPassword($user) { $userId = $user['User']['id']; $email = new CakeEmail(); $fromConfig = Configure::read('Site.email'); $fromNameConfig = Configure::read('site.emailFromName'); $email->from(array($fromConfig => $fromNameConfig)); $email->sender(array($fromConfig => $fromNameConfig)); $email->to($user['User']['email']); $email->subject(Configure::read('site.emailFromName') . ': Request to Reset Your Password'); $activate_key = $this->getActivationKey($user['User']['passwd']); $link = Router::url("activate_password/{$userId}/{$activate_key}", true); $body = __("Welcome ") . $user['User']['first_name'] . __(", let's help you get signed in\nYou have requested to have your password reset on ") . Configure::read('site.emailFromName') . __(". Please click the link below to reset your password now :\n") . $link . __("\nIf above link does not work please copy and paste the URL link (above) into your browser address bar to get to the Page to reset password\n\nChoose a password you can remember and please keep it secure.\n\nThanks,") . "\n" . Configure::read('site.emailFromName'); try { $result = $email->send($body); $this->updateAll(array('password_key' => "'" . $activate_key . "'"), array('id' => $userId)); } catch (Exception $ex) { // we could not send the email, ignore it $result = __("Could not send forgot password email to userid-") . $userId; } $this->log($result, LOG_DEBUG); }
private function __sendRentReminderManual($emailTo, $message, $unit_number, $rent_due, $payment_id, $first_name, $billing_start, $billing_end, $rent_period) { $from = Configure::read('RentSquare.supportemail'); try { $email = new CakeEmail(); $email->domain('rentsquaredev.com'); $email->sender('*****@*****.**', 'RentSquare Support'); $email->template('manualreminder', 'generic')->emailFormat('html')->from(array($from => 'RentSquare Support'))->to(trim($emailTo))->subject('RentSquare Rent Reminder')->viewVars(array('message' => $message, 'unit_number' => $unit_number, 'rent_due' => $rent_due, 'payment_id' => $payment_id, 'first_name' => $first_name, 'billing_start' => $billing_start, 'billing_end' => $billing_end, 'rent_period' => $rent_period))->send(); } catch (Exception $e) { return false; } return true; }
function _sendEmail($template, $to, $subject, $viewVarsArray, $text = "") { $Email = new CakeEmail(); $Email->config('gmail'); $Email->sender('*****@*****.**', 'Volunteer Omaha'); $Email->from(array('*****@*****.**' => 'Volunteer Omaha')); $Email->to($to); $Email->subject($subject); if (!empty($text)) { $Email->emailFormat('html'); $Email->send($text); } else { $Email->emailFormat('html'); $Email->template($template); $Email->viewVars($viewVarsArray); $Email->send(); } }
private function __sendPropertyActivation($prop_data) { $from = Configure::read('RentSquare.supportemail'); try { $email = new CakeEmail(); $email->domain('rentsquaredev.com'); $email->sender('*****@*****.**', 'RentSquare Support'); $email->template('approveproperty', 'generic')->emailFormat('html')->from(array($from => 'RentSquare Support'))->to($prop_data['Manager']['email'])->subject('Property Approved')->viewVars(array('prop_data' => $prop_data))->send(); } catch (Exception $e) { return false; } return true; }
/** * メールを送信する * * @param string $to 送信先アドレス * @param string $title タイトル * @param mixed $body 本文 * @param array $options オプション * @return bool 送信結果 */ public function sendMail($to, $title = '', $body = '', $options = array()) { $options = array_merge(array('agentTemplate' => true, 'template' => 'default'), $options); if (!empty($this->siteConfigs['smtp_host'])) { $transport = 'Smtp'; $host = $this->siteConfigs['smtp_host']; $port = $this->siteConfigs['smtp_port'] ? $this->siteConfigs['smtp_port'] : 25; $username = $this->siteConfigs['smtp_user'] ? $this->siteConfigs['smtp_user'] : null; $password = $this->siteConfigs['smtp_password'] ? $this->siteConfigs['smtp_password'] : null; $tls = $this->siteConfigs['smtp_tls'] && $this->siteConfigs['smtp_tls'] == 1; } else { $transport = 'Mail'; $host = 'localhost'; $port = 25; $username = null; $password = null; $tls = null; } $config = array('transport' => $transport, 'host' => $host, 'port' => $port, 'username' => $username, 'password' => $password, 'tls' => $tls); $cakeEmail = new CakeEmail($config); // charset if (!empty($this->siteConfigs['mail_encode'])) { $encode = $this->siteConfigs['mail_encode']; } else { $encode = 'ISO-2022-JP'; } // ISO-2022-JPの場合半角カナが文字化けしてしまうので全角に変換する if ($encode == 'ISO-2022-JP') { $title = mb_convert_kana($title, 'KV', "UTF-8"); if (is_string($body)) { $body = mb_convert_kana($body, 'KV', "UTF-8"); } elseif (isset($body['message']) && is_array($body['message'])) { foreach ($body['message'] as $key => $val) { if (is_string($val)) { $body['message'][$key] = mb_convert_kana($val, 'KV', "UTF-8"); } } } } //CakeEmailの内部処理のencodeを統一したいので先に値を渡しておく $cakeEmail->headerCharset($encode); $cakeEmail->charset($encode); //$format if (!empty($options['format'])) { $cakeEmail->emailFormat($options['format']); } else { $cakeEmail->emailFormat('text'); } //bcc 'mail@example.com,mail2@example.com' if (!empty($options['bcc'])) { // 文字列の場合 $bcc = array(); if (is_string($options['bcc'])) { if (strpos($options['bcc'], ',') !== false) { $bcc = explode(',', $options['bcc']); } else { $bcc[] = $options['bcc']; } // 配列の場合 } elseif (is_array($options['bcc'])) { $bcc = $options['bcc']; } foreach ($bcc as $val) { if (Validation::email(trim($val))) { $cakeEmail->addBcc($val); } } unset($bcc); } //cc 'mail@example.com,mail2@example.com' if (!empty($options['cc'])) { // 文字列の場合 $cc = array(); if (is_string($options['cc'])) { if (strpos($options['cc'], ',') !== false) { $cc = explode(',', $options['cc']); } else { $cc[] = $options['cc']; } // 配列の場合 } elseif (is_array($options['cc'])) { $cc = $options['cc']; } foreach ($cc as $val) { if (Validation::email(trim($val))) { $cakeEmail->addCc($val); } } unset($cc); } // to 送信先アドレス (最初の1人がTOで残りがBCC) if (strpos($to, ',') !== false) { $_to = explode(',', $to); $i = 0; if (count($_to) >= 1) { foreach ($_to as $val) { if ($i == 0) { $cakeEmail->addTo($val); $toAddress = $val; } else { $cakeEmail->addBcc($val); } ++$i; } } } else { $cakeEmail->addTo($to); } // 件名 $cakeEmail->subject($title); //From $fromName = $from = ''; if (!empty($options['from'])) { $from = $options['from']; } else { if (!empty($this->siteConfigs['email'])) { $from = $this->siteConfigs['email']; if (strpos($from, ',') !== false) { $from = explode(',', $from); } } else { $from = $toAddress; } } if (!empty($options['fromName'])) { $fromName = $options['fromName']; } else { if (!empty($this->siteConfigs['formal_name'])) { $fromName = $this->siteConfigs['formal_name']; } else { $formalName = Configure::read('BcApp.title'); } } $cakeEmail->from($from, $fromName); //Reply-To if (!empty($options['replyTo'])) { $replyTo = $options['replyTo']; } else { $replyTo = $from; } $cakeEmail->replyTo($replyTo); //Return-Path if (!empty($options['returnPath'])) { $returnPath = $options['returnPath']; } else { $returnPath = $from; } $cakeEmail->returnPath($returnPath); //$sender if (!empty($options['sender'])) { $cakeEmail->sender($options['sender']); } //$theme if ($this->theme) { $cakeEmail->theme($this->theme); } if (!empty($options['theme'])) { $cakeEmail->theme($options['theme']); } //viewRender (利用するviewクラスを設定する) $cakeEmail->viewRender('BcApp'); //template if (!empty($options['template'])) { $layoutPath = $subDir = $plugin = ''; if ($options['agentTemplate'] && Configure::read('BcRequest.agent')) { $layoutPath = Configure::read('BcRequest.agentPrefix'); $subDir = Configure::read('BcRequest.agentPrefix'); } list($plugin, $template) = pluginSplit($options['template']); if ($subDir) { $template = "{$subDir}/{$template}"; } if (!empty($plugin)) { $template = "{$plugin}.{$template}"; } if (!empty($options['layout'])) { $cakeEmail->template($template, $options['layout']); } else { $cakeEmail->template($template); } $content = ''; if (is_array($body)) { $cakeEmail->viewVars($body); } else { $cakeEmail->viewVars(array('body' => $body)); } } else { $content = $body; } // $attachments tmp file path $attachments = array(); if (!empty($options['attachments'])) { if (!is_array($options['attachments'])) { $attachments = array($options['attachments']); } else { $attachments = $options['attachments']; } } $cakeEmail->attachments($attachments); try { $cakeEmail->send($content); return true; } catch (Exception $e) { $this->log($e->getMessage()); return false; } }
public function SendAdminMail($userData) { $email = new CakeEmail('smtp'); $email->from(array('*****@*****.**' => 'YumPlate Support')); $email->sender($userData['email']); $email->to(Configure::read('Settings.SUPPORT_EMAIL')); $email->emailFormat('html'); $email->subject('Query mail'); $body = "Query from User :" . $userData['name'] . '<br/>' . ' email:' . $userData['email'] . '<br/> query:' . $userData['message']; try { $result = $email->send($body); } catch (Exception $ex) { // we could not send the email, ignore it return false; } return true; }
function _sendRegistrationConfirmationEmail($event_id) { $user = $this->Session->read('Auth.User'); $this->loadModel('Event'); $event = $this->Event->findById($event_id); $username = $user['username']; $eventUrl = 'http://' . env('SERVER_NAME') . '/volunteeromaha/events/view/' . $event['Event']['id']; $Email = new CakeEmail(); $Email->config('gmail'); $Email->template('event_registration_confirm'); $Email->sender('*****@*****.**', 'Volunteer Omaha'); $Email->from(array('*****@*****.**' => 'Volunteer Omaha')); $Email->to($user['email']); $Email->subject('Event registration confirmation'); $Email->emailFormat('html'); $Email->viewVars(array('username' => $username, 'event_url' => $eventUrl, 'event_name' => $event['Event']['name'])); $Email->send(); }
private function __sendTenantInvite($emailTo, $passwd, $user_id, $property, $unit_num) { $from = Configure::read('RentSquare.supportemail'); $this->loadModel('Unit'); $user_det = $this->User->findById($user_id); try { $email = new CakeEmail(); $email->domain('rentsquaredev.com'); $email->sender('*****@*****.**', 'RentSquare Support'); $email->template('inviteresident', 'generic')->emailFormat('html')->from(array($from => 'RentSquare Support'))->to($emailTo)->subject('You have been invited to use RentSquare')->viewVars(array('user_details' => $user_det, 'property' => $property, 'unit_num' => $unit_num, 'emailAdd' => $emailTo, 'passwd' => $passwd))->send(); } catch (Exception $e) { return false; } return true; }
public function contact() { $this->autoRender = false; if ($this->request->is('post')) { //pr($this->data);die; $email = new CakeEmail('smtp'); $email->sender($this->request->data['email']); $email->to(Configure::read('Settings.ADMIN_EMAIL')); $email->emailFormat('html'); if ($this->request->data['type'] == 'contact') { $email->subject('Query mail from contact page'); } else { $email->subject('Query mail from become yumcook page'); } $body = " "; $body .= " Full Name : " . $this->request->data['name'] . '<br/>' . ' Email : ' . $this->request->data['email'] . '<br/> message : ' . $this->request->data['message'] . '<br />'; try { $result = $email->send($body); } catch (Exception $ex) { // we could not send the email, ignore it // pr($ex); echo json_encode(array('type' => 'failure', 'msg' => 'There is problem in email network .Please try again after some time.')); die; } echo json_encode(array('type' => 'success')); die; } }
/** * From 各種セット * * @param string $from 送信者メールアドレス * @param string $fromName 送信者名 * @return void */ private function __setFrom($from, $fromName = null) { parent::from($from, $fromName); // 通称envelope-fromセット(正式名reverse-path RFC 5321) parent::sender($from, $fromName); // Return-Path(RFC 5322)セット - config['transport' => 'Mail']用 $config = $this->config(); $config['additionalParameters'] = '-f' . $from; $this->config($config); }
private function __sendMessageNotification($convId = null, $userIds = null, $fromUser = null, $title = null, $message = null) { $this->loadModel('User'); $from = Configure::read('RentSquare.supportemail'); $sender = $this->User->findById($fromUser); $sender_name = $sender['User']['first_name'] . ' ' . $sender['User']['last_name']; $user_ids = array(); //If Conversation already exists if ($convId != null) { $this->loadModel('ConversationsUser'); $users = $this->ConversationsUser->find('all', array('conditions' => array('ConversationsUser.conversation_id' => $convId), 'fields' => array('user_id'))); foreach ($users as $user) { array_push($user_ids, $user["ConversationsUser"]['user_id']); } } else { $user_ids = $userIds; } //send email to each user if they have the send email notification checked foreach ($user_ids as $user_id) { if ($user_id != $fromUser) { $this->User->contain(); $user = $this->User->findById($user_id); if ($user['User']['email_for_messages']) { try { $email = new CakeEmail(); $email->domain('rentsquaredev.com'); $email->sender('*****@*****.**', 'RentSquare Support'); $email->template('newmessagenotification', 'generic')->emailFormat('html')->from(array($from => 'RentSquare Support'))->to($user['User']['email'])->subject('New Message - RentSquare')->viewVars(array('fromUser' => $sender_name, 'title' => $title, 'message' => $message))->send(); } catch (Exception $e) { //return false; } } } } return true; }
private function __NotifyTenantOfApproval($emailTo, $unit_num, $tenant_name, $property_name) { $from = Configure::read('RentSquare.supportemail'); try { $email = new CakeEmail(); $email->domain('rentsquaredev.com'); $email->sender('*****@*****.**', 'RentSquare Support'); $email->template('residentapproved', 'generic')->emailFormat('html')->from(array($from => 'RentSquare Support'))->to($emailTo)->subject('Welcome to RentSquare!')->viewVars(array('tenant_name' => $tenant_name, 'unit_num' => $unit_num, 'property_name' => $property_name))->send(); } catch (Exception $e) { return false; } return true; }
private function __sendRentLateReminderMail($email_address, $data) { $from = Configure::read('RentSquare.supportemail'); try { $email = new CakeEmail(); $email->domain('rentsquaredev.com'); $email->sender('*****@*****.**', 'RentSquare Support'); $result = $email->template('rentlate', 'generic')->emailFormat('html')->from(array($from => 'RentSquare Support'))->to($email_address)->subject('Rent Late Reminder - RentSquare')->viewVars(array('unit_num' => $data['unit_num'], 'rent_due' => $data['rent_due'], 'first_name' => $data['first_name'], 'billing_start' => $data['billing_end'], 'billing_end' => $data['rent_period'], 'property_name' => $data['property_name']))->send(); } catch (Exception $e) { return false; } return true; }
function __sendActivationEmail($user_id) { $user = $this->getUserById($user_id); if ($user === false) { debug(__METHOD__ . " failed to retrieve User data for user.id: {$user_id}"); return false; } $username = $this->data['User']['username']; $activationUrl = 'http://' . env('SERVER_NAME') . '/volunteeromaha/users/activate/' . $user['User']['id'] . '/' . $this->User->getActivationHash(); $Email = new CakeEmail(); $Email->config('gmail'); $Email->template('registration_confirm'); $Email->sender('*****@*****.**', 'Volunteer Omaha'); $Email->from(array('*****@*****.**' => 'Volunteer Omaha')); $Email->to($user['User']['email']); $Email->subject('Confirm Registration'); $Email->emailFormat('html'); $Email->viewVars(array('username' => $username, 'activate_url' => $activationUrl)); $Email->send(); }