当前位置: 首页>>代码示例>>PHP>>正文


PHP Email::set方法代码示例

本文整理汇总了PHP中Email::set方法的典型用法代码示例。如果您正苦于以下问题:PHP Email::set方法的具体用法?PHP Email::set怎么用?PHP Email::set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Email的用法示例。


在下文中一共展示了Email::set方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: changeStatus

 public function changeStatus()
 {
     $status = (int) $this->request->get('status');
     $shipment = Shipment::getInstanceByID('Shipment', (int) $this->request->get('id'), true, array('Order' => 'CustomerOrder', 'ShippingAddress' => 'UserAddress'));
     $shipment->loadItems();
     $zone = $shipment->getDeliveryZone();
     $shipmentRates = $zone->getShippingRates($shipment);
     $shipment->setAvailableRates($shipmentRates);
     $history = new OrderHistory($shipment->order->get(), $this->user);
     $shipment->status->set($status);
     $shipment->save();
     $history->saveLog();
     $status = $shipment->status->get();
     $enabledStatuses = $this->config->get('EMAIL_STATUS_UPDATE_STATUSES');
     $m = array('EMAIL_STATUS_UPDATE_NEW' => Shipment::STATUS_NEW, 'EMAIL_STATUS_UPDATE_PROCESSING' => Shipment::STATUS_PROCESSING, 'EMAIL_STATUS_UPDATE_AWAITING_SHIPMENT' => Shipment::STATUS_AWAITING, 'EMAIL_STATUS_UPDATE_SHIPPED' => Shipment::STATUS_SHIPPED);
     $sendEmail = false;
     foreach ($m as $configKey => $constValue) {
         if ($status == $constValue && array_key_exists($configKey, $enabledStatuses)) {
             $sendEmail = true;
         }
     }
     if ($sendEmail || $this->config->get('EMAIL_STATUS_UPDATE')) {
         $user = $shipment->order->get()->user->get();
         $user->load();
         $email = new Email($this->application);
         $email->setUser($user);
         $email->setTemplate('order.status');
         $email->set('order', $shipment->order->get()->toArray(array('payments' => true)));
         $email->set('shipments', array($shipment->toArray()));
         $email->send();
     }
     return new JSONResponse(false, 'success');
 }
开发者ID:saiber,项目名称:www,代码行数:33,代码来源:ShipmentController.php

示例2: sendMessage

 private function sendMessage(NewsletterSentMessage $sent, LiveCart $application)
 {
     $config = $application->getConfig();
     $email = new Email($application);
     $email->setTemplate('newsletter/template');
     $email->set('subject', $this->subject->get());
     $email->set('htmlMessage', $this->html->get());
     $email->set('text', $this->text->get());
     $email->set('email', $this->text->get());
     $email->setFrom($config->get('NEWSLETTER_EMAIL') ? $config->get('NEWSLETTER_EMAIL') : $config->get('MAIN_EMAIL'), $config->get('STORE_NAME'));
     if ($user = $sent->user->get()) {
         $email->setTo($user->email->get(), $user->getName());
         $email->set('email', $user->email->get());
     } else {
         if ($subscriber = $sent->subscriber->get()) {
             $email->setTo($subscriber->email->get());
             $email->set('email', $subscriber->email->get());
         }
     }
     //$sent->time->set(new ARExpressionHandle('NOW()'));
     $sent->save();
     if ($this->status->get() == self::STATUS_NOT_SENT) {
         $this->status->set(self::STATUS_PARTIALLY_SENT);
         $this->time->set(new ARExpressionHandle('NOW()'));
         $this->save();
     }
     return $email->send();
 }
开发者ID:saiber,项目名称:www,代码行数:28,代码来源:NewsletterMessage.php

示例3: add

 public function add()
 {
     if ($this->buildOrderNoteValidator()->isValid()) {
         $order = CustomerOrder::getInstanceById($this->request->get('id'), CustomerOrder::LOAD_DATA);
         $note = OrderNote::getNewInstance($order, $this->user);
         $note->isAdmin->set(true);
         $note->text->set($this->request->get('comment'));
         $note->save();
         if ($this->config->get('EMAIL_ORDERNOTE')) {
             $order->user->get()->load();
             $email = new Email($this->application);
             $email->setUser($order->user->get());
             $email->setTemplate('order.message');
             $email->set('order', $order->toArray(array('payments' => true)));
             $email->set('message', $note->toArray());
             $email->send();
         }
         return new ActionRedirectResponse('backend.orderNote', 'view', array('id' => $note->getID()));
     } else {
         return new RawResponse('invalid');
     }
 }
开发者ID:saiber,项目名称:livecart,代码行数:22,代码来源:OrderNoteController.php

示例4: send

 public function send()
 {
     if (!$this->buildValidator()->isValid()) {
         return new ActionRedirectResponse('contactForm', 'index');
     }
     $email = new Email($this->application);
     $email->setTemplate('contactForm/contactForm');
     $email->setFrom($this->request->get('email'), $this->request->get('name'));
     $email->setTo($this->config->get('NOTIFICATION_EMAIL'), $this->config->get('STORE_NAME'));
     $email->set('message', $this->request->get('msg'));
     $email->send();
     return new ActionRedirectResponse('contactForm', 'sent');
 }
开发者ID:saiber,项目名称:livecart,代码行数:13,代码来源:ContactFormController.php

示例5: queue_to_email

 public static function queue_to_email($to_email, $to_name, $subject, $text, $html)
 {
     $email = new Email();
     $email->set('user_id', $user->id);
     $email->set('subject', $subject);
     $email->set('text_body', $text);
     $email->set('html_body', $html);
     $email->set('to_email', $to_email);
     $email->set('to_name', $to_name);
     $email->set('queue_date', date("Y-m-d H:i:s"));
     $email->set('status', 'queued');
     $email->save();
     //send it right away.
     //$email->send();
 }
开发者ID:ricberw,项目名称:BotQueue,代码行数:15,代码来源:email.php

示例6: subscribe

 public function subscribe()
 {
     $email = $this->request->get('email');
     if (!$this->user->isAnonymous() || User::getInstanceByEmail($email)) {
         return new ActionRedirectResponse('newsletter', 'alreadySubscribed');
     }
     $validator = $this->getSubscribeValidator();
     if (!$validator->isValid()) {
         return new ActionRedirectResponse('index', 'index');
     }
     $instance = NewsletterSubscriber::getInstanceByEmail($email);
     if (!$instance) {
         $instance = NewsletterSubscriber::getNewInstanceByEmail($email);
     }
     $instance->save();
     $mail = new Email($this->application);
     $mail->setTo($email);
     $mail->setTemplate('newsletter/confirm');
     $mail->set('subscriber', $instance->toArray());
     $mail->set('email', $email);
     $mail->send();
     return new ActionResponse('subscriber', $instance->toArray());
 }
开发者ID:saiber,项目名称:livecart,代码行数:23,代码来源:NewsletterController.php

示例7: queue_to_email

 public static function queue_to_email($to_email, $to_name, $subject, $text, $html, $user_id = 0)
 {
     $email = new Email();
     $email->set('user_id', $user_id);
     $email->set('subject', $subject);
     $email->set('text_body', $text);
     $email->set('html_body', $html);
     $email->set('to_email', $to_email);
     $email->set('to_name', $to_name);
     $email->set('queue_date', date("Y-m-d H:i:s"));
     $email->set('status', 'queued');
     $email->save();
     //send it right away, or queue it.
     if (!(defined("QUEUE_EMAIL") && QUEUE_EMAIL)) {
         $email->send();
     }
     return $email;
 }
开发者ID:eric116,项目名称:BotQueue,代码行数:18,代码来源:email.php

示例8: action_index

 public function action_index()
 {
     $email = Security::xss_clean(Arr::get($this->post, 'email', ''));
     $user = ORM::factory('User')->where('email', '=', $email)->find();
     if ($user->loaded() && $user->network_reg == 0 && empty($user->link_activate)) {
         $date = date("Y-m-d H:i:s");
         $code = md5($date . $user->password);
         Email::connect();
         Email::View('reminderapi');
         Email::set(array('username' => $user->username, 'id' => $code, 'url' => URL::media($this->language . '/auth/recovery/', true)));
         Email::send($user->email, array('no-reply@e-history.kz', 'e-history.kz'), "E-history.kz, ссылка для смены пароля.", '', true);
         $save_code = ORM::factory('User', $user->id);
         $save_code->link_recovery = $code;
         $save_code->save();
         $this->data = true;
     } else {
         $this->data['error'] = 'Email is not registered';
     }
     $this->response->body(json_encode($this->data));
 }
开发者ID:HappyKennyD,项目名称:teest,代码行数:20,代码来源:Passwordrecovery.php

示例9: do_register

 public function do_register()
 {
     $request = $this->application->getRequest();
     $first_name = $request->get('firstName');
     $last_name = $request->get('lastName');
     $company = $request->get('companyName');
     $email = $request->get('email');
     $pass = $request->get('password');
     if (!isset($first_name) || !isset($last_name) || !isset($email) || !isset($pass)) {
         throw new Exception("Please complete required field " . $last_name);
     }
     $user = User::getInstanceByEmail($email);
     if (isset($user)) {
         throw new Exception('User already exist');
     }
     $user = User::getNewInstance($email, $pass);
     $user->firstName->set($first_name);
     $user->lastName->set($last_name);
     if (isset($company)) {
         $user->companyName->set($company);
     }
     $user->email->set($email);
     $user->isEnabled->set('1');
     $user->save();
     $code = rand(1, 10000000) . rand(1, 10000000);
     $user->setPreference('confirmation', $code);
     $user->save();
     $_email = new Email($this->application);
     $_email->setUser($user);
     $_email->set('code', $code);
     $_email->setTemplate('user.confirm');
     $_email->send();
     $response = new LiveCartSimpleXMLElement('<response datetime="' . date('c') . '"></response>');
     $response->addChild('state', '1');
     return new SimpleXMLResponse($response);
 }
开发者ID:saiber,项目名称:www,代码行数:36,代码来源:UserApi.php

示例10: action_materials

 public function action_materials()
 {
     if (!Auth::instance()->logged_in()) {
         $this->redirect('/', 301);
     }
     $user_id = $this->user->id;
     $materials = ORM::factory('Material')->where('user_id', '=', $user_id);
     $paginate = Paginate::factory($materials)->paginate(NULL, NULL, 3)->render();
     $materials = $materials->find_all();
     $this->set('materials', $materials);
     $this->set('paginate', $paginate);
     $uploader = View::factory('storage/materials')->set('user_id', $user_id)->render();
     $this->set('uploader', $uploader);
     if ($this->request->method() == Request::POST) {
         $journal = (int) Arr::get($_POST, 'material_type', 0);
         if ($journal !== 1) {
             $journal = 0;
         }
         try {
             $material = ORM::factory('Material');
             $material->theme = substr(Arr::get($_POST, 'theme', ''), 0, 250);
             $material->message = substr(Arr::get($_POST, 'message', ''), 0, 500);
             $material->user_id = $user_id;
             $material->date = date('Y-m-d H:i:s');
             $material->lang_notice = strtolower(Kohana_I18n::lang());
             if ($journal) {
                 $material->is_journal = 1;
                 $material->is_moderator = 0;
             }
             $material->save();
             $files = Arr::get($_POST, 'files', '');
             if ($files) {
                 foreach ($files as $key => $file) {
                     if ($key > 7) {
                         break;
                     }
                     if ($file) {
                         $storage = ORM::factory('Storage', (int) $file);
                         try {
                             $upload = ORM::factory('Material_File');
                             $upload->user_id = $user_id;
                             $upload->material_id = $material->id;
                             $upload->date = date('Y-m-d H:i:s');
                             $upload->storage_id = (int) $file;
                             $upload->filesize = filesize($storage->file_path);
                             $upload->save();
                         } catch (ORM_Validation_Exception $e) {
                         }
                     }
                 }
             }
             Message::success(i18n::get('The material sent to the moderator. Thank you!'));
             $user = ORM::factory('User', $user_id);
             $user_email = $user->email;
             Email::connect();
             Email::View('review_now_' . i18N::lang());
             Email::set(array('message' => I18n::get('Оставленный вами материал находится на рассмотрении редакционной коллегии портала')));
             Email::send($user_email, array('no-reply@e-history.kz', 'e-history.kz'), I18n::get('Рассмотрение материала на портале "История Казахстана" e-history.kz'), '', true);
             if ($journal != 1) {
                 $material_type = 'Интересные материалы';
                 $url = URL::media('/manage/materials', TRUE);
             } else {
                 $material_type = 'Журнал e-history';
                 $url = URL::media('/manage/materials/ehistory', TRUE);
             }
             $user_profile = ORM::factory('User_Profile', $user_id);
             if ($user_profile->first_name != '') {
                 $user_name = $user_profile->first_name . ' ' . $user_profile->last_name;
             } else {
                 $user_name = $user->username;
             }
             $email = 'kaz.ehistory@gmail.com';
             Email::connect();
             Email::View('new_material');
             Email::set(array('url' => $url, 'material_type' => $material_type, 'username' => $user_name));
             Email::send($email, array('no-reply@e-history.kz', 'e-history.kz'), "Новый материал на e-history.kz", '', true);
             $this->redirect('profile/materials', 301);
         } catch (ORM_Validation_Exception $e) {
             $errors = $e->errors($e->alias());
             $files = Arr::get($_POST, 'files', '');
             $this->set('errors', $errors)->set('material', $_POST)->set('files', $files);
         }
     }
     $this->add_cumb('User profile', 'profile');
     $this->add_cumb('Downloaded Content', '/');
 }
开发者ID:HappyKennyD,项目名称:teest,代码行数:86,代码来源:Profile.php

示例11: email_testingOp

 /**
  * 测试邮件发送
  *
  * @param
  * @return
  */
 public function email_testingOp()
 {
     /**
      * 读取语言包
      */
     $lang = Language::getLangContent();
     $email_type = trim($_POST['email_type']);
     $email_host = trim($_POST['email_host']);
     $email_port = trim($_POST['email_port']);
     $email_addr = trim($_POST['email_addr']);
     $email_id = trim($_POST['email_id']);
     $email_pass = trim($_POST['email_pass']);
     $email_test = trim($_POST['email_test']);
     $subject = $lang['test_email'];
     $site_url = SiteUrl;
     $site_title = $GLOBALS['setting_config']['site_name'];
     $message = '<p>' . $lang['this_is_to'] . "<a href='" . $site_url . "' target='_blank'>" . $site_title . '</a>' . $lang['test_email_send_ok'] . '</p>';
     if ($email_type == '1') {
         require_once BasePath . DS . 'framework' . DS . 'libraries' . DS . 'email.php';
         $obj_email = new Email();
         $obj_email->set('email_server', $email_host);
         $obj_email->set('email_port', $email_port);
         $obj_email->set('email_user', $email_id);
         $obj_email->set('email_password', $email_pass);
         $obj_email->set('email_from', $email_addr);
         $obj_email->set('site_name', $site_title);
         $result = $obj_email->send($email_test, $subject, $message);
     } else {
         $result = @mail($email_test, $subject, $message);
     }
     if ($result === false) {
         $message = $lang['test_email_send_fail'];
         if (strtoupper(CHARSET) == 'GBK') {
             $message = Language::getUTF8($message);
         }
         showMessage($message, '', 'json');
     } else {
         $message = $lang['test_email_send_ok'];
         if (strtoupper(CHARSET) == 'GBK') {
             $message = Language::getUTF8($message);
         }
         showMessage($message, '', 'json');
     }
 }
开发者ID:noikiy,项目名称:ecmall,代码行数:50,代码来源:setting.php

示例12: sendContactForm

 public function sendContactForm()
 {
     $product = Product::getInstanceByID($this->request->get('id'), Product::LOAD_DATA);
     $redirect = new ActionRedirectResponse('product', 'index', array('id' => $product->getID()));
     $validator = $this->buildContactValidator();
     if ($validator->isValid()) {
         $email = new Email($this->application);
         $email->setTemplate('contactForm/productInquiry');
         $email->setFrom($this->request->get('email'), $this->request->get('name'));
         $email->setTo($this->config->get('NOTIFICATION_EMAIL'), $this->config->get('STORE_NAME'));
         $email->set('message', $this->request->get('msg'));
         $email->set('product', $product->toArray());
         $email->send();
         $msg = $this->translate('_inquiry_form_sent');
         if ($this->isAjax()) {
             $response = new JSONResponse(array('message' => $msg), 'success');
         } else {
             $this->setMessage($msg);
             $response = $redirect;
         }
         return $response;
     } else {
         if ($this->isAjax()) {
             return new JSONResponse(array('errors' => $validator->getErrorList()));
         } else {
             return $redirect;
         }
     }
 }
开发者ID:saiber,项目名称:www,代码行数:29,代码来源:ProductController.php

示例13: sendEmails

 /**
  * Sends all emails stored in email db, with a one second delay between each sending.
  *
  */
 public function sendEmails()
 {
     $sql = "SELECT * FROM emails WHERE status <> 'sent'";
     $q = $this->db->query($sql);
     $r = $q->result_array();
     if (!$this->input->post('submit')) {
         $viewData['emails'] = $r;
         $this->load->view('control/send_emails', $viewData);
         return;
     }
     $this->load->model('email');
     foreach ($r as $emailAssoc) {
         sleep(1);
         $email = new Email();
         $email->fromAssoc($emailAssoc);
         $this->load->library('swiftwrap');
         if ($result = $this->swiftwrap->email('recruitment@exambuff.co.uk', '44naughty', $email->get('receiver'), $email->get('subject'), $email->get('message'))) {
             $email->set('status', Email::SENT);
             $viewData['messages'][] = "Successfully emailed " . $email->get('receiver') . ", with email: " . $email->get('subject');
         } else {
             $email->set('error', $result);
             $email->set('status', Email::FAILED);
         }
         $email->update();
     }
 }
开发者ID:cybercog,项目名称:exambuff,代码行数:30,代码来源:control.php

示例14: createUser

 /**
  *	@return User
  */
 private function createUser($password = '', $prefix = '')
 {
     $user = User::getNewInstance($this->request->get('email'), $this->request->get('password'));
     $user->firstName->set($this->request->get($prefix . 'firstName'));
     $user->lastName->set($this->request->get($prefix . 'lastName'));
     $user->companyName->set($this->request->get($prefix . 'companyName'));
     $user->email->set($this->request->get('email'));
     $user->isEnabled->set(!$this->config->get('REG_EMAIL_CONFIRM'));
     // custom fields
     $user->loadRequestData($this->request, array());
     if ($password) {
         $this->session->set('password', $password);
         $user->setPassword($password);
     }
     $user->save();
     if (!$this->config->get('REG_EMAIL_CONFIRM')) {
         SessionUser::setUser($user);
         $this->sendWelcomeEmail($user);
     } else {
         $code = rand(1, 10000000) . rand(1, 10000000);
         $user->setPreference('confirmation', $code);
         $user->save();
         $email = new Email($this->application);
         $email->setUser($user);
         $email->set('code', $code);
         $email->setTemplate('user.confirm');
         $email->send();
     }
     return $user;
 }
开发者ID:GregerA,项目名称:livecart,代码行数:33,代码来源:UserController.php

示例15: action_new

 public function action_new()
 {
     $id = (int) $this->request->param('id', 0);
     $debate = ORM::factory('Debate', $id);
     if ($debate->loaded() and !$debate->admin_create) {
         $this->redirect('manage/debate');
     }
     $this->set('debate', $debate);
     if ($this->request->method() == Request::POST) {
         $author_email = strtolower(Arr::get($_POST, 'author_email', ''));
         $opponent_email = strtolower(Arr::get($_POST, 'opponent_email', ''));
         $author = ORM::factory('User')->where('email', '=', $author_email)->find();
         $opponent = ORM::factory('User')->where('email', '=', $opponent_email)->find();
         if ($opponent->loaded() && $author->loaded() && $author_email != $opponent_email) {
             if ($debate->loaded()) {
                 $old_title = $debate->title;
                 $old_description = $debate->description;
                 $old_end_time = $debate->end_time;
                 $old_author = $debate->author_id;
                 $old_opponent = $debate->opponent_id;
             } else {
                 $debate_create = true;
             }
             try {
                 $debate->title = Arr::get($_POST, 'title', '');
                 $debate->description = Arr::get($_POST, 'description', '');
                 $debate->lifetime = (int) Arr::get($_POST, 'lifetime', '');
                 $debate->date = $debate->start_time = date('Y-m-d H:i:s');
                 $debate->end_time = date('Y-m-d H:i:s', strtotime("+" . $debate->lifetime . " hours", strtotime(date('Y-m-d H:i:s'))));
                 $debate->author_id = $debate->replier_id = $author->id;
                 $debate->author_email = $author_email;
                 $debate->opponent_id = $opponent->id;
                 $debate->opponent_email = $opponent_email;
                 $debate->language = $this->language;
                 $debate->is_public = 1;
                 $debate->admin_create = 1;
                 $debate->save();
                 if (isset($old_title) && $old_title != $debate->title) {
                     $this->log($debate->id, 'title', $old_title, $debate->title);
                 }
                 if (isset($old_description) && $old_description != $debate->description) {
                     $this->log($debate->id, 'description', $old_description, $debate->description);
                 }
                 if (isset($old_end_time) && $old_end_time != $debate->end_time) {
                     $this->log($debate->id, 'time', $old_end_time, $debate->end_time);
                 }
                 if (isset($old_author) && $old_author != $debate->author_id) {
                     $this->log($debate->id, 'member', $old_author, $debate->author_id);
                 }
                 if (isset($old_opponent) && $old_opponent != $debate->opponent_id) {
                     $this->log($debate->id, 'member', $old_opponent, $debate->opponent_id);
                 }
                 if (isset($debate_create)) {
                     $this->log($debate->id, 'create');
                 }
                 Message::success(i18n::get('Дебаты сохранены'));
                 $debate_link = Url::site("debate/view/" . $debate->id, true);
                 $ending_tr = "Your opponent was given the right to begin debates";
                 Email::connect();
                 Email::View('new_debate');
                 Email::set(array('author' => $author->username, 'link' => 'e-history.kz', 'theme' => "<a href='" . $debate_link . "'>'" . $debate->title . "'</a>", 'ending' => true, 'ending_tr' => $ending_tr));
                 Email::send($debate->opponent_email, array('no-reply@e-history.kz', 'e-history.kz'), __("Участие в дебатах на тему :theme", array(':theme' => "'" . $debate->title . "'")), '', true);
                 $ending_tr = "You are given the right to begin debates";
                 Email::connect();
                 Email::View('new_debate');
                 Email::set(array('author' => $opponent->username, 'link' => 'e-history.kz', 'theme' => "<a href='" . $debate_link . "'>'" . $debate->title . "'</a>", 'ending' => true, 'ending_tr' => $ending_tr));
                 Email::send($debate->author_email, array('no-reply@e-history.kz', 'e-history.kz'), __("Участие в дебатах на тему :theme", array(':theme' => "'" . $debate->title . "'")), '', true);
                 $this->redirect('manage/debate');
             } catch (ORM_Validation_Exception $e) {
                 $errors = $e->errors($e->alias());
                 $this->set('debate', $_POST);
                 $this->set('errors', $errors);
             }
         } else {
             if (!$author->loaded()) {
                 $errors['author_email'] = true;
             }
             if (!$opponent->loaded()) {
                 $errors['opponent_email'] = true;
             }
             if ($author_email == $opponent_email) {
                 $errors['members'] = true;
             }
             $this->set('debate', $_POST);
             $this->set('errors', $errors);
         }
     }
 }
开发者ID:HappyKennyD,项目名称:teest,代码行数:88,代码来源:Debate.php


注:本文中的Email::set方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。