本文整理汇总了PHP中CakeEmail类的典型用法代码示例。如果您正苦于以下问题:PHP CakeEmail类的具体用法?PHP CakeEmail怎么用?PHP CakeEmail使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CakeEmail类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: contact
public function contact()
{
$this->setTitle('Liên hệ');
if ($this->request->is('post')) {
$this->loadModel('Contact');
$save_data = array('Contact' => array('name' => $this->request->data('name'), 'address' => $this->request->data('address'), 'phone' => $this->request->data('phone'), 'email' => $this->request->data('email'), 'title' => 'Liên hệ : ' . $this->request->data('name'), 'descriptions' => $this->request->data('message')));
if ($this->Contact->save($save_data)) {
$Email = new CakeEmail('smtp');
$Email->emailFormat('text')->subject($save_data['Contact']['title']);
$this->loadModel('Setting');
$mail_lists = $this->Setting->getCacheSetting('mail_receiver');
$mail_lists = explode(';', $mail_lists['emails']['value']);
$mail_lists = array_filter($mail_lists);
// $mail_lists = Configure::read('mail_receiver');
if ($mail_lists) {
$Email->to($mail_lists);
$content = "\nNgười gửi : {$save_data['Contact']['name']} \n\nSố điện thoại : {$save_data['Contact']['phone']} \n\nEmail : {$save_data['Contact']['email']} \n\nĐịa chỉ : {$save_data['Contact']['address']} \n\nNội dung liên hệ : {$save_data['Contact']['descriptions']}\n\n\n\n ";
$Email->send($content);
}
echo json_encode(array('status' => 'ok', 'messages' => array('Cảm ơn bạn đã quan tâm đến BIOWAY-HITECH <br>Chúng tôi sẽ liên lạc lại bạn trong thời gian sớm nhất')));
die;
} else {
echo 'ng';
die;
}
}
}
开发者ID:CaoLP,项目名称:phanbon,代码行数:27,代码来源:PagesController.php
示例2: send
/**
* Send mail
*
* @param CakeEmail $email CakeEmail
* @return array
*/
public function send(CakeEmail $email)
{
$headers = $email->getHeaders(array('from', 'sender', 'replyTo', 'readReceipt', 'returnPath', 'to', 'cc', 'subject'));
$headers = $this->_headersToString($headers);
$message = implode("\r\n", (array) $email->message());
return array('headers' => $headers, 'message' => $message);
}
开发者ID:agashish,项目名称:test_new,代码行数:13,代码来源:DebugTransport.php
示例3: sendPassword
public function sendPassword($emailLog)
{
$searchPlayer = "Select email From players As Player Where email = '";
$searchPlayer .= $emailLog;
$searchPlayer .= "'";
if (!$this->query($searchPlayer)) {
return false;
} else {
/*
* renvoie un pass chiffré. PAS BON !!
* renvoyer un mot de pass par défault
* rediriger vers la page change password
* faire comme si on changeait le mdp
*/
$tempPass = $this->generatePassword();
$tempPassCrypted = Security::hash($tempPass);
$updatePass = "Update players Set password = '" . $tempPassCrypted . "' Where email = '" . $emailLog . "'";
$this->query($updatePass);
//@todo: sauvegarder dans la base
$message = "Voici votre mot de passe temporaire. Connectez-vous avec pour le changer.";
App::uses('CakeEmail', 'Network/Email');
$mail = new CakeEmail('rox');
$mail->to($emailLog)->subject('WebArena Information')->template('player')->viewVars(array('message' => $message, 'email' => $emailLog, 'password' => $tempPass))->emailFormat('html');
return $mail->send();
}
}
开发者ID:afluong,项目名称:webarena,代码行数:26,代码来源:Player.php
示例4: register
/**
* Выдает информацию о пользователе
*
* @param array $data
* @return array
*/
public function register($data)
{
if ($data['full_name']) {
if (isset($data['surname']) and $data['surname']) {
$data['full_name'] = $data['full_name'] . ' ' . $data['surname'];
}
} else {
list($userName) = explode('@', $data['username']);
$data['full_name'] = $userName;
}
unset($data['surname']);
$this->User->set($data);
if (!$this->User->validates()) {
throw new ApiIncorrectRequestException($this->User->validationErrors);
}
if (!in_array($data['lang'], array('eng', 'rus'))) {
$errors = array('lang' => array('Incorrect Lang'));
throw new ApiIncorrectRequestException($errors);
}
if ($this->User->save($data)) {
$user = $this->User->findByUsername($data['username']);
$userId = Hash::get($user, 'User.id');
$userName = Hash::get($user, 'User.full_name');
$userMail = Hash::get($user, 'User.username');
$pass = substr($user['User']['password'], 0, 5);
$pass = md5('iP5UxZWIbVJ1XJIW' . $pass);
$Email = new CakeEmail();
$Email->template('reg_confirm', 'mail')->viewVars(array('userId' => $userId, 'userName' => $userName, 'userMail' => $userMail, 'token' => $pass))->emailFormat('html')->from('[email protected]')->to($data['username'])->subject('Verify registration on Konstruktor.com')->send();
return $userId;
} else {
throw new Exception('Registration Error');
}
}
开发者ID:nilBora,项目名称:konstruktor,代码行数:39,代码来源:ApiUser.php
示例5: sendEmail
/**
* メール送信処理
*/
public function sendEmail($to, $subject, $template, $body = null)
{
// メールライブラリ読み込み
App::uses('CakeEmail', 'Network/Email');
$email = new CakeEmail();
$res = $email->config(array('log' => 'emails'))->template($template, 'default')->viewVars($body)->from(array('[email protected]' => __('iPost Enterprise運営事務局')))->to($to)->subject($subject)->send();
}
开发者ID:buiquangquyet,项目名称:ipost,代码行数:10,代码来源:AppManagerController.php
示例6: send
public function send() {
ini_set('max_execution_time', 0);
$test = array(
array('User' => array('email' =>'[email protected]'))
);
$this->User->unbindAll();
$users = $this->User->find('all', array('fields' => array('email'), 'conditions' => array('email not like "%@facebook.com%"'), 'order' => array('id DESC')));
$count = 1;
foreach ($users as $user) {
if (!empty($user['User']['email'])) {
$count++;
try {
$email = new CakeEmail('stars');
$email->template('open')
->emailFormat('html')
->from(array('[email protected]' => '5Stars MobileGames Ltd'))
->to($user['User']['email'])
//->bcc(array('[email protected]'))
->subject('Mỹ Hầu Vương | Tri ân người chơi tặng Gift code 500k nhân ngày Openbeta')
->send();
echo $count.' sent to '.$user['User']['email'].' waiting 10 sec...'. "\n";
sleep(1);
} catch(Exception $e) {
echo $e->getMessage();
echo $count.'cannot send to '.$user['User']['email']. "\n";
}
}
}
}
开发者ID:hungnt88,项目名称:5stars-1,代码行数:32,代码来源:SendEmailShell.php
示例7: index
public function index()
{
//checking session
$uid = $this->Session->read('Auth.User.id');
if (isset($uid)) {
return $this->redirect(array('controller' => 'profiles', 'action' => 'edit'));
}
$this->layout = 'main';
$title = 'User Registration';
$this->set(compact('title'));
//check from submit or not
if ($this->request->is('post')) {
//uploading image file
$new_file_name = rand(1000, rand(100000, rand(1000000, 10000000))) . "_" . md5(time()) . "_" . time() . $this->data['Profile']['image']['name'];
move_uploaded_file($this->data['Profile']['image']['tmp_name'], $_SERVER['DOCUMENT_ROOT'] . '/registration/app/webroot/img/image/' . $new_file_name);
$this->request->data['Profile']['image'] = '/registration/app/webroot/img/image/' . $new_file_name;
//----------------------
//save data
if ($this->Profile->save($this->request->data)) {
$Email = new CakeEmail();
$Email->from(array('[email protected]' => 'Cake registration demo'));
$Email->to($this->data['Profile']['email']);
$Email->subject('Registration process completed successfully');
$Email->send('Welcome to cake registration demo .Your registration process completed successfully');
$this->Session->setFlash('User details has been saved.', 'default', array('class' => 'alert alert-success'));
return $this->redirect(array('action' => 'login'));
}
//------------
//on failure
$this->Session->setFlash('Unable to add User details.', 'default', array('class' => 'alert alert-danger'));
}
}
开发者ID:planetwebsolution,项目名称:cakephp,代码行数:32,代码来源:ProfilesController.php
示例8: send
public function send()
{
if ($this->request->is('post')) {
// Check security token
if (empty($this->request->data['Feedback']['token']) || $this->request->data['Feedback']['token'] != '!pilule$') {
throw new NotFoundException();
}
// Send feedback via email
$Email = new CakeEmail();
if (!empty($this->request->data['Feedback']['name']) && !empty($this->request->data['Feedback']['email'])) {
$Email->replyTo(array($this->request->data['Feedback']['email'] => $this->request->data['Feedback']['name']));
}
$Email->from('[email protected]');
$Email->to('[email protected]');
$Email->config('postmark');
$Email->subject('Pilule - Commentaires');
$Email->template('feedback');
$Email->emailFormat('html');
$Email->viewVars(array('message' => $this->request->data));
if ($Email->send()) {
return new CakeResponse(array('body' => json_encode(array('status' => true))));
} else {
return new CakeResponse(array('body' => json_encode(array('status' => false))));
}
} elseif ($this->request->is('ajax')) {
$this->layout = 'ajax';
$this->render('modals/form');
}
}
开发者ID:julienasp,项目名称:Pilule,代码行数:29,代码来源:FeedbackController.php
示例9: forget
public function forget()
{
if ($this->request->is('post')) {
$error = null;
$email = $this->request->data['User']['email'];
$result = $this->User->find('first', array('conditions' => array('User.email' => $email)));
if ($result == null || empty($result)) {
$error = "メールアドレスが登録されていません。";
} else {
$host = empty($_SERVER['CAKE_ENV']) ? 'localhost' : $_SERVER['CAKE_ENV'];
$pre_id = $result['User']['pre_id'];
$gmail = new CakeEmail('gmail');
$gmail->to($email);
$gmail->subject('seapaパスワード再設定URL');
$messages = $gmail->send('パスワード再設定URL : http://' . $host . '/regist/reinput?pre_id=' . $pre_id);
if ($messages == null) {
$error = "メールが送信できませんでした。管理者にお問い合わせください。";
}
}
if (empty($error)) {
$this->redirect(array('controller' => 'preregist', 'action' => 'result'));
} else {
$this->Session->setFlash($error, "flash_error");
}
}
}
开发者ID:saramune,项目名称:seapa,代码行数:26,代码来源:PreregistController.php
示例10: sendEmail
protected function sendEmail($address, $username, $pass)
{
$subject = 'You now are an user of Employees Directory!';
$body = 'Your username : ' . $username . '. Your password : ' . $pass . '. (not include the last period)';
$email = new CakeEmail('smtp');
$email->to($address)->subject($subject)->send($body);
}
开发者ID:anbt,项目名称:employee-directory,代码行数:7,代码来源:UsersController.php
示例11: run
/**
* Find a potential queue and if found, send each email one by one
*
* @return void
*/
public function run()
{
// The consumer ID will be placed against all pending emails
$consumerId = uniqid();
// Inform the user of the consumer id before proceeding
$this->_renderHeader();
$this->out(" Consumer ID: {$consumerId}", 2);
// Search for pending emails and apply the consumer id to them
if (!$this->EmailQueue->updatePending($consumerId)) {
return $this->out(' Found 0 items in queue, exiting ...', 2);
}
// Find all the emails which were assigned with the consumer id
$pendingItems = $this->EmailQueue->pendingItems($consumerId);
$this->out(' Found ' . count($pendingItems) . ' items in queue, dispatching:', 2);
// Loop through each email one by one
foreach ($pendingItems as $item) {
// Inform the user which email is being processed currency
$this->out(' ' . str_pad("# {$item['EmailQueue']['id']}", 7, ' ') . ' ' . str_pad($item['EmailQueue']['to'] . ' ', 40, '.'), false);
// Use your preferred email config here
$email = new CakeEmail('custom');
// Attempt to send the serialized email using the above config, log the status
if ($email->transportClass()->send(unserialize($item['EmailQueue']['serialized']))) {
$status = 1;
$this->out(' [<success> OK </success>]', 2);
} else {
$status = 2;
$this->out(' [<warning> !! </warning>]', 2);
}
// Attempt to update the email queue record with the new status
if (!$this->EmailQueue->saveItemStatus($item['EmailQueue']['id'], $status)) {
throw new Exception("Saving queue item failed, orphan created for ID #{$item['EmailQueue']['id']}!");
}
}
}
开发者ID:thedrumz,项目名称:music,代码行数:39,代码来源:EmailQueueShell.php
示例12: individualMail
public function individualMail($section, $arr = array())
{
$this->autoRender = false;
$contents = $this->Mail->findBySection($section);
$content = $contents['Mail']['content'];
foreach ($arr as $key => $val) {
$content = str_replace("~~{$key}~~", $val, $content);
}
if (!empty($arr['TO_EMAIL']) && Validation::email($arr['TO_EMAIL'], true)) {
$email = new CakeEmail();
$email->template('default');
$email->config('default');
$email->emailFormat('html')->to($arr['TO_EMAIL'])->subject($contents['Mail']['subject']);
try {
if ($email->send($content)) {
return;
} else {
return;
}
} catch (Exception $e) {
return;
}
}
return;
}
开发者ID:pushpendraraj,项目名称:tigzie,代码行数:25,代码来源:MailController.php
示例13: _sendEmail
protected function _sendEmail()
{
App::uses('CakeEmail', 'Network/Email');
$Email = new CakeEmail();
$Email->emailFormat('text')->template('new_user', 'default')->from(Configure::read('Site.email_from'))->replyTo($this->request->data['Contact']['email'])->subject('EU-GENIE Contact Form')->to(Configure::read('Site.email_to'));
$Email->send();
}
开发者ID:priyankasingh,项目名称:Genie,代码行数:7,代码来源:ContactsController.php
示例14: contactus
public function contactus()
{
if ($this->request->data) {
$this->request->data['Contact'] = Sanitize::clean($this->request->data, array("remove_html" => TRUE));
$cakeEmail = new CakeEmail('default');
if ($this->request->data['Contact']['emailbool'] == "2") {
$email_to = Configure::read('Config.general');
$cakeEmail->template('enquiry', 'default')->emailFormat('html')->to($email_to)->subject('HaRiMau - General Enquiry');
} else {
$email_to = Configure::read('Config.business');
$cakeEmail->template('enquiry', 'default')->emailFormat('html')->to($email_to)->subject('HaRiMau - Business Enquiry');
}
$cakeEmail->viewVars(array('user' => $this->request->data));
if ($cakeEmail->send()) {
$cnt_data = $this->Notification->find('count', array('conditions' => array('markas' => 'Unread', 'type' => 'Contact')));
$arr['Notification']['type'] = 'Contact';
$arr['Notification']['status'] = 'Approve';
$arr['Notification']['count'] = $cnt_data + 1;
$arr['Notification']['markas'] = 'Unread';
$arr['Notification']['bell'] = 'On';
$noti = $this->Notification->save($arr);
$noti_data = $this->Notification->find('all', array('conditions' => array('markas' => 'Unread')));
$numNoti = count($noti_data);
$this->set('count', $numNoti);
$this->Session->setFlash('<div class="alert alert-success"><i class="fa fa-check-circle"></i> An email with details is sent to system admin as earliest as will replied you. <button data-dismiss="alert" class="close" type="button">×</button> </div>');
//$this->Session->setFlash(__('An email with details is sent to system admin as earliest as will replied you. '));
} else {
$this->Session->setFlash('<div class="alert alert-danger"><i class="fa fa-exclamation-circle"></i> Problem on sending email to enquiry department. Please contact to administrator.<button data-dismiss="alert" class="close" type="button">×</button> </div>');
//$this->Session->setFlash(__('Problem on sending email to enquiry department. Please contact to administrator'));
}
} else {
$this->set('count', 0);
}
}
开发者ID:beyondkeysystem,项目名称:testone,代码行数:34,代码来源:HomeController.php
示例15: preview
public function preview($e)
{
$configName = $e['EmailQueue']['config'];
$template = $e['EmailQueue']['template'];
$layout = $e['EmailQueue']['layout'];
$headers = empty($e['EmailQueue']['headers']) ? array() : (array) $e['EmailQueue']['headers'];
$theme = empty($e['EmailQueue']['theme']) ? null : (string) $e['EmailQueue']['theme'];
if (empty($theme)) {
$theme = '';
}
$email = new CakeEmail($configName);
$email->transport('Debug')->to($e['EmailQueue']['to'])->subject($e['EmailQueue']['subject'])->template($template, $layout)->emailFormat($e['EmailQueue']['format'])->addHeaders($headers)->theme($theme)->messageId(false)->returnPath($email->from())->viewVars($e['EmailQueue']['template_vars']);
$return = $email->send();
$this->out('Content:');
$this->hr();
$this->out($return['message']);
$this->hr();
$this->out('Headers:');
$this->hr();
$this->out($return['headers']);
$this->hr();
$this->out('Data:');
$this->hr();
debug($e['EmailQueue']['template_vars']);
$this->hr();
$this->out();
}
开发者ID:mikebirch,项目名称:cakephp-email-queue,代码行数:27,代码来源:PreviewShell.php
示例16: mark_complete
/**
* Mark Complete method - Sets Risk Asessment to complete in the Clients Model
*
*/
public function mark_complete()
{
$completed = date('Y-m-d');
// Get DateTime
$client = $this->Session->read('Auth.User.client_id');
$clientName = $this->Session->read('Auth.User.Client.name');
$this->loadModel('Client');
$this->Client->id = $client;
$this->render(false);
// tell cake to not use a view
$existing_completion_date = $this->Client->field('risk_assessment_status');
if ($existing_completion_date != '') {
$this->Session->setFlash(__('Your Risk Assessment was already marked complete on ') . $existing_completion_date . '.');
$this->redirect(array('action' => 'index'));
return;
}
// Send Email
$message = 'New Risk Assessment Completed by Client ' . $clientName . ' - Completed on ' . $completed;
$email = new CakeEmail('hipaaMail');
$email->to(Configure::read('App.adminEmailTo'))->subject('HIPAA Risk Assessment Marked Complete by Client - ' . $clientName)->send($message);
if ($this->Client->saveField('risk_assessment_status', $completed)) {
$this->Session->setFlash('Thanks! Your Risk Assessment has been marked complete.', 'default', array('class' => 'success message'));
$this->redirect(array('controller' => 'dashboard', 'action' => 'index'));
} else {
$this->Session->setFlash(__('Sorry, Risk Assessment did not complete. Please, try again.'));
$this->redirect(array('controller' => 'dashboard', 'action' => 'index'));
}
}
开发者ID:dipeshpatel306,项目名称:effective-adventure,代码行数:32,代码来源:DashboardController.php
示例17: autopurr
/**
Sender purringer til alle som har vært forfalt og ikke purret i minst to uker
Sender melding til alle som har vært forfalt i mindre enn to uker, og ikke allerede har fått melding
**/
function autopurr()
{
$purret = array();
$meldt = array();
$feil = array();
foreach ($this->PurreFaktura->find('list', array('fields' => 'faktura_id')) as $faktura) {
if ($this->Purring->epostPurring($faktura, 'purring')) {
$purret[] = $faktura;
} else {
$feil[] = $faktura;
}
}
/*
foreach($this->MeldeFaktura->find('list', array('fields'=>'faktura_id')) as $faktura){
if($this->Purring->epostPurring($faktura, 'faktura_melding'))
$meldt[] = $faktura;
else
$feil[] = $faktura;
}
*/
if (count($purret) > 0) {
$logg_mail = new CakeEmail('default');
$logg_mail->to("[email protected]")->subject("Automatisk utførte purringar")->template('autopurr_logg', 'vanlig')->emailFormat('html')->viewVars(array('purret' => $purret, 'navn' => 'Purrere i Zapatistgruppa', 'epost' => '', 'feil' => $feil))->send();
}
return;
}
开发者ID:vsanth,项目名称:rekneskap,代码行数:31,代码来源:Faktura.php
示例18: email_referrer
function email_referrer($receiver = null, $invite_total = null, $code = null)
{
$share_link = FULL_BASE_URL . '/invite/' . $code;
//For our coming soon incentive, we were increasing peoples call rates by 10 cents for every person that joined the site from their link
//so the funciton below simply calculates their new rate.
//add in your own function if you want
$total_referrals = $invite_total;
$current_rate = 2.5 + $invite_total * 0.1;
if ($current_rate > 3.5) {
$current_rate = 3.5;
}
$message = 'Nice work!
<br /><br />
One of your friends just joined Amplifyd. Your new caller rate is now $' . $current_rate . '0/per call.
<br /><br />
Because of you, our public voice just got stronger and louder.
<br /><br />
Keep it up, here\'s your unique invite link again:
<br />
<a href="' . $share_link . '" >' . $share_link . '</a>
<br /><br />
';
$email = new CakeEmail('sendgrid');
$email->emailFormat('html');
$email->to($receiver);
$email->subject('A Friend Just Joined');
$email->send($message);
}
开发者ID:suspended,项目名称:CakePHP-Coming-Soon-Website-With-Referral-Rewards,代码行数:28,代码来源:SignupsController.php
示例19: sendEmail
public function sendEmail($event)
{
$user_email = $event->subject()->data['User']['email'];
App::uses('CakeEmail', 'Network/Email');
$email = new CakeEmail('default');
$email->to($user_email)->subject(__('Welcome on Sonerezh !'))->emailFormat('html')->template('userAdd')->send();
}
开发者ID:RauchF,项目名称:sonerezh,代码行数:7,代码来源:UsersEventListener.php
示例20: index
public function index()
{
if (!$this->request->data) {
$this->render();
return;
}
$this->User->validate = array('email' => array(array('rule' => 'notEmpty', 'message' => 'メールアドレスを入力してください'), array('rule' => array('custom', '/^.+@.+$/'), 'message' => 'メールアドレスの形式が正しくありません。'), array('rule' => 'confirm', 'message' => 'メールアドレスが一致していません。'), array('rule' => 'isUniqueAndActive', 'message' => 'このメールアドレスは使用されています。')));
$this->User->set($this->request->data);
if (!$this->User->invalidFields()) {
$email = $this->request->data['User']['email'];
$activation_code = md5($email . time());
$user = $this->User->find('first', array('conditions' => array('email' => $email, 'is_active' => false)));
if (!$user) {
$this->User->create();
$user = array('User' => $this->request->data['User']);
}
$user['User']['is_active'] = false;
$user['User']['activation_code'] = $activation_code;
$this->User->save($user);
$cakeemail = new CakeEmail('default');
$cakeemail->to($email);
$cakeemail->subject('仮登録のお知らせ');
$cakeemail->send(sprintf('http://example.com/signup/activate/%s', $activation_code));
$this->render('email_sent');
}
}
开发者ID:rasken2003,项目名称:CakePHP2-Recipe,代码行数:26,代码来源:SignupController.php
注:本文中的CakeEmail类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论