本文整理匯總了PHP中CakeEmail::send方法的典型用法代碼示例。如果您正苦於以下問題:PHP CakeEmail::send方法的具體用法?PHP CakeEmail::send怎麽用?PHP CakeEmail::send使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類CakeEmail
的用法示例。
在下文中一共展示了CakeEmail::send方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testPostmarkSend
/**
* testSendgridSend method
*
* @return void
*/
public function testPostmarkSend()
{
$this->email->template('default', 'default');
$this->email->emailFormat('both');
$this->email->to(array('test1@example.com' => 'Recipient'));
$this->email->subject('Test email via SedGrid');
$this->email->addHeaders(array('X-Tag' => 'my tag'));
$sendReturn = $this->email->send();
// $headers = $this->email->getHeaders(array('to'));
// $this->assertEqual($sendReturn['To'], $headers['To']);
// $this->assertEqual($sendReturn['ErrorCode'], 0);
// $this->assertEqual($sendReturn['Message'], 'OK');
}
示例2: 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('me@example.com' => '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'));
}
}
示例3: sendEmail
public function sendEmail($to = NULL, $subject = NULL, $data = NULL, $template = NULL, $format = 'text', $cc = NULL, $bcc = NULL)
{
$Email = new CakeEmail();
$Email->from(array(Configure::read('Email_From_Email') => Configure::read('Email_From_Name')));
//$Email->config(Configure::read('TRANSPORT'));
$Email->config('default');
$Email->template($template);
if ($to != NULL) {
$Email->to($to);
}
if ($cc != NULL) {
$Email->cc($cc);
}
if ($bcc != NULL) {
$Email->bcc($bcc);
}
$Email->subject($subject);
$Email->viewVars($data);
$Email->emailFormat($format);
if ($Email->send()) {
return true;
} else {
return false;
}
}
示例4: 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('web@alexandreclement.com');
$Email->to('web@alexandreclement.com');
$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');
}
}
示例5: exacute
public function exacute()
{
$books = $this->Book->find('all', array('conditions' => array('Book.state' => 'Bet Finish')));
foreach ($books as $book) {
$time_zone = $this->Book->TimeZone->find('first', array('conditions' => array('TimeZone.id' => $book['Book']['time_zone'])));
if (isset($time_zone['TimeZone']) && isset($time_zone['TimeZone']['value'])) {
$bookdaystate = new BookDayState($book, $time_zone['TimeZone']['value']);
if ($bookdaystate->isTimeOut() && $book['Book']['timeover_info'] == false) {
/*
$content = 'The result has not been selected after 24 hours from the announcement date and time the corresponding book is disabled and all points wagered are returned to all punters.
The bookmaker will receive a penalty.
Book Title : '.$book['Book']['title'].'<br>Total Bet : '.$book['Book']['bet_all_total'].'<br>Total User : '.$book['Book']['user_all_count'].'
'.'<a href="http://bookbookmaker.com/books'.'/'.$book['Book']['id'].'">http://bookbookmaker.com/books'.'/'.$book['Book']['id'].'</a>';
*/
$Email = new CakeEmail('sendGrid');
$Email->template('timeover');
$Email->to($book['User']['mail']);
$Email->subject('Bookタイムオーバー bookbookmaker.com');
$Email->viewVars(array('book' => $book));
$Email->send();
$this->Book->seTimeover($book['Book']['id']);
} else {
}
}
}
}
示例6: contact
public function contact()
{
$this->loadModel('Contact');
if ($this->request->is('post')) {
$this->Contact->set($this->request->data);
if ($this->Contact->validates()) {
App::uses('CakeEmail', 'Network/Email');
if ($this->request->data['Contact']['subject'] == '') {
$this->request->data['Contact']['subject'] = 'Contact';
}
$Email = new CakeEmail('smtp');
$Email->viewVars(array('mailData' => $this->request->data));
$Email->template('contact', 'default');
$Email->emailFormat('html');
$Email->from(array($this->request->data['Contact']['mail'] => $this->request->data['Contact']['name']));
$Email->to('contact@youthbook.be');
$Email->subject($this->request->data['Contact']['subject']);
$Email->attachments(array('logo.png' => array('file' => WWW_ROOT . '/img/icons/logo.png', 'mimetype' => 'image/png', 'contentId' => 'logo')));
$Email->send();
$this->Flash->success(__('Votre mail a bien été envoyé.'));
return $this->redirect($this->referer());
} else {
$this->Session->write('errors.Contact', $this->Contact->validationErrors);
$this->Session->write('data', $this->request->data);
$this->Session->write('flash', 'Le mail n’a pas pu être envoyé. Veuillez réessayer SVP.');
return $this->redirect($this->referer());
}
}
}
示例7: CakeEmail
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
示例8: 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);
}
}
示例9: send_mail
/**
* Send comfirmation email whit unique code
*/
public function send_mail()
{
$user = $this->Session->read('Auth');
if (isset($user)) {
if ($user['User']['active'] == 0) {
$uniqueId = uniqid("", TRUE);
if ($this->saveSendComfirmation($user, $uniqueId)) {
App::uses('CakeEmail', 'Network/Email');
$email = new CakeEmail('gmail');
$link = "http://" . $_SERVER['HTTP_HOST'] . $this->webroot . "email/activate_account/" . $user['User']['id'] . '-' . $uniqueId;
$email->from('stagesstatcoordonateur@gmail.com');
$email->to($user['User']['email']);
$email->subject('Mail Confirmation');
$email->emailFormat('html');
$email->template('signup');
$email->viewVars(array('username' => $user['User']['full_name'], 'link' => $link));
$this->Session->setFlash(__('Email comfirmation has been sent'), 'flash/success');
$email->send();
} else {
$this->Session->setFlash(__('Could not send email.'), 'flash/error');
}
} else {
$this->Session->setFlash(__('Your email is already comfirmed.'), 'flash/error');
}
} else {
$this->Session->setFlash(__('You are not login.'), 'flash/error');
}
$this->redirect('/');
}
示例10: _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();
}
示例11: main
public function main()
{
// =============================================================================================
// 各種情報を取得
// =============================================================================================
// 今年分の振込情報を取得
$year = date('Y');
$transfer_histories = $this->TTransferHistory->findTransferHistory($year);
// 振込目標額を取得
$total_price = $this->MParameter->find('first', array('conditions' => array('parameter_name' => 'total_price'), 'fields' => array('parameter_value')));
$total_price = $total_price['MParameter']['parameter_value'];
// 合計振込額を取得
$total_transfer_price = $this->TTransferHistory->find('first', array('conditions' => array('deleted' => 1), 'fields' => array('sum(transfer_price) as total_transfer_price')));
$total_transfer_price = $total_transfer_price[0]['total_transfer_price'];
// 振込殘高を取得
$remaining_price = $total_price - $total_transfer_price;
// =============================================================================================
// メール送信処理
// =============================================================================================
$email = new CakeEmail('admin');
$email->to('1970emerson.lake.and.palmer@gmail.com');
$email->subject($year . '年の振込情報');
$email->emailFormat('text');
$email->template('transfer_report');
$email->viewVars(array('total_price' => number_format($total_price), 'total_transfer_price' => number_format($total_transfer_price), 'remaining_price' => number_format($remaining_price), 'year' => $year, 'transfer_histories' => $transfer_histories));
$email->send();
}
示例12: 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();
}
示例13: forgot
/**
* permet de refaire un mot de passe oublié
* @return [type] [description]
**/
public function forgot()
{
$this->layout = "home";
if (!empty($this->request->data)) {
$user = $this->User->findByMail($this->request->data['User']['mail'], array('id'));
if (empty($user)) {
$this->Session->setFlash(__("This email address is not associated with any account"), 'notif', array('class' => "danger", 'type' => 'info'));
} else {
$token = md5(uniqid() . time());
$this->User->id = $user['User']['id'];
$this->User->saveField('token', $token);
App::uses('CakeEmail', 'Network/Email');
$cakeMail = new CakeEmail('smtp');
// à changer par default sur le site en ligne ou smtp en local
$cakeMail->to($this->request->data['User']['mail']);
$cakeMail->from(array('philippewagner2@sfr.fr' => "site "));
$cakeMail->subject(__('Password regeneration'));
$cakeMail->template('forgot');
$cakeMail->viewVars(array('token' => $token, 'id' => $user['User']['id']));
$cakeMail->emailFormat('text');
$cakeMail->send();
$this->Session->setFlash(__("An email was sent to you with instructions to regenerate your password! Please check your span !!"), "notif", array('class' => 'info', 'type' => 'info'));
}
}
}
示例14: handleException
public function handleException(Exception $exception, $shutdown = false)
{
$this->_exception = $exception;
$email = new CakeEmail('error');
$prefix = Configure::read('ExceptionNotifier.prefix');
$from = $email->from();
if (empty($from)) {
$email->from('exception.notifier@default.com', 'Exception Notifier');
}
$subject = $email->subject();
if (empty($subject)) {
$email->subject($prefix . '[' . date('Ymd H:i:s') . '][' . $this->_getSeverityAsString() . '][' . ExceptionText::getUrl() . '] ' . $exception->getMessage());
}
if ($this->useSmtp) {
$email->transport('Smtp');
$email->config($this->smtpParams);
}
$text = ExceptionText::getText($exception->getMessage(), $exception->getFile(), $exception->getLine());
$email->send($text);
// return Exception.handler
if ($shutdown || !$this->_exception instanceof ErrorException) {
$config = Configure::read('Exception');
$handler = $config['handler'];
if (is_string($handler)) {
call_user_func($handler, $exception);
} elseif (is_array($handler)) {
call_user_func_array($handler, $exception);
}
}
}
示例15: 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();
}
}