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


PHP Email::factory方法代码示例

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


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

示例1: action_register

 public function action_register()
 {
     if (isset($_POST['submit'])) {
         $data = Arr::extract($_POST, array('username', 'password', 'first_name', 'password_confirm', 'email', 'phone', 'address', 'country_id', 'zone_id', 'city_id', 'agree'));
         $users = ORM::factory('user');
         // $content->message = '';
         // $content->message = Captcha::valid($_POST['captcha'])? 'Не угадал';
         try {
             $regdate = date("Y-M-D");
             $users->create_user($_POST, array('username', 'first_name', 'password', 'email', 'phone', 'address', 'country_id', 'zone_id', 'city_id', 'regdate' => $regdate));
             $role = ORM::factory('role', array('name' => 'login'));
             $users->add('roles', $role);
             // $users->add('roles', 1);
             $email = Email::factory('Регистрация на сайте', 'Регистрация на сайте успешно завешена')->to($data['email'], $data['first_name'])->from('admin@mykohana.loc', 'mykohan')->send();
             $this->action_login();
             $this->request->redirect('account');
             //	$this->reg_ok = "<p><b>Ваш профил успешно созданно</b></p>";
             $this->action_login();
             $this->request->redirect('account');
         } catch (ORM_Validation_Exception $e) {
             $errors = $e->errors('user');
         }
     }
     $captcha = Captcha::instance();
     $captcha_image = $captcha->render();
     $country = ORM::factory('country')->find_all();
     $zones = ORM::factory('zone')->where('country_id', '=', 176)->find_all();
     $form_register = View::factory('v_registration', array('country' => $country, 'zones' => $zones))->bind('errors', $errors)->bind('data', $data)->bind('captcha_image', $captcha_image);
     // Выводим в шаблон
     $this->template->title = 'Регистрация';
     $this->template->page_title = 'Регистрация новога пользователя';
     $this->template->block_center = array('form_register' => $form_register);
 }
开发者ID:raku,项目名称:mykohana,代码行数:33,代码来源:auth.php

示例2: _execute

 /**
  * This is a demo task
  *
  * @return null
  */
 protected function _execute(array $params)
 {
     # TEXT
     Email::factory('Hello, World', 'This is my body, it is nice.')->to('wufeifei@wufeifei.com')->from('ad@simple-site.cn', '简站AD(Simple-Site)')->send();
     # HTML
     Email::factory('Hello, World', 'This is my body, it is nice.')->to('wufeifei@wufeifei.com')->from('ad@simple-site.cn', '简站AD(Simple-Site)')->message('<h1>This is <em>my</em> body, it is <strong>nice</strong>.</h1>', 'text/html')->send();
 }
开发者ID:wangyandong,项目名称:SimpleSite,代码行数:12,代码来源:ad.php

示例3: batch_send_with_sleep

 public static function batch_send_with_sleep()
 {
     set_time_limit(0);
     $stats = array('sent' => 0, 'failed' => 0);
     $size = Config::get('email_queue', 'batch_size');
     $interval = Config::get('email_queue', 'interval');
     $emails = ORM::factory('email_queue')->find_batch();
     Kohana::$log->add(Log::INFO, 'Send emails with sleep, interval: :interval, size: :size.', array(':interval' => $interval, ':size' => $size))->write();
     $i = 0;
     ob_end_flush();
     foreach ($emails as $email) {
         if ($i >= $size) {
             $i = 0;
             @ob_flush();
             sleep($interval);
         }
         if (Email::factory($email->subject)->from($email->sender_email, $email->sender_name)->to($email->recipient_email, $email->recipient_name)->message($email->body->body, 'text/html')->send()) {
             $email->sent();
             $stats['sent']++;
         } else {
             $email->failed();
             $stats['failed']++;
         }
         $i++;
     }
     Kohana::$log->add(Log::INFO, 'Send emails with sleep. Sent: :sent, failed: :failed', array(':sent' => $stats['sent'], ':failed' => $stats['failed']))->write();
     return $stats;
 }
开发者ID:ZerGabriel,项目名称:cms-1,代码行数:28,代码来源:queue.php

示例4: index

 public function index()
 {
     if ($this->request->isGet()) {
         $this->assign("columns", Table::factory('Contacts')->getColumns());
     }
     if ($this->request->isPost()) {
         $contact = Table::factory('Contacts')->newObject();
         if ($contact->setValues($this->request->getPost())) {
             // all good. add, and stuff
             $contact->save();
             $address = Settings::getValue("contact.address");
             $subject = "Enquiry via paynedigital.com";
             $from = $contact->name . " <" . $contact->email . ">";
             $email = Email::factory();
             $email->setFrom($from);
             $email->setTo($address);
             $email->setSubject($subject);
             $email->setBody($this->fetchTemplate("emails/contact", array("query" => $contact->content, "name" => $contact->name)));
             $email->send();
             if (!$this->request->isAjax()) {
                 $this->setFlash("contact_thanks");
                 return $this->redirectAction("thanks");
             }
         } else {
             $this->setErrors($contact->getErrors());
         }
     }
 }
开发者ID:Asedol,项目名称:paynedigital.com,代码行数:28,代码来源:contact.php

示例5: add_comment

 public function add_comment()
 {
     if (!$this->post->commentsEnabled()) {
         return $this->redirect("/articles/" . $this->post->getUrl());
     }
     // very basic honeypot stuff
     if ($this->request->getVar("details")) {
         $this->setErrors(array("details" => "Please do not fill in the details field"));
         return $this->render("view_post");
     }
     $comment = Table::factory('Comments')->newObject();
     $name = $this->request->getVar("name") != "" ? $this->request->getVar("name") : "Anonymous";
     $data = array("post_id" => $this->post->getId(), "name" => $name, "email" => $this->request->getVar("email"), "content" => $this->request->getVar("content"), "approved" => false, "ip" => $this->request->getIp(), "notifications" => $this->request->getVar("notifications"));
     if ($comment->setValues($data)) {
         $comment->save();
         $address = Settings::getValue("contact.address");
         $subject = "New comment submission (paynedigital.com)";
         $from = $comment->name . " <" . $comment->email . ">";
         $email = Email::factory();
         $email->setFrom($from);
         $email->setTo($address);
         $email->setSubject($subject);
         $email->setBody($this->fetchTemplate("emails/comment", array("post" => $this->post, "comment" => $comment)));
         $email->send();
         if (!$this->request->isAjax()) {
             $this->setFlash("comment_thanks");
             return $this->redirect("/articles/" . $this->post->getUrl() . "/comment/thanks#comments");
         }
     } else {
         $this->setErrors($comment->getErrors());
     }
     return $this->render("view_post");
 }
开发者ID:Asedol,项目名称:paynedigital.com,代码行数:33,代码来源:blog.php

示例6: action_index

 public function action_index()
 {
     $config = Kohana::$config->load('huia/email');
     $values = Arr::map('strip_tags', $this->request->post());
     $view = View::factory('huia/email/' . $values['view']);
     $view->set($values);
     $result = Email::factory($values['subject'], $view->render(), 'text/html')->to($values['to_email'])->from($config->from_email, $config->from_name)->send();
     $this->response->body(@json_encode(array('success' => $result)));
 }
开发者ID:huiancg,项目名称:kohana-huia-email,代码行数:9,代码来源:Email.php

示例7: post_send

 public function post_send()
 {
     $subject = $this->param('subject', NULL, TRUE);
     $sender_name = $this->param('sender_name', Config::get('site', 'name'));
     $sender_email = $this->param('sender_email', Config::get('email', 'default'));
     $to = $this->param('to', NULL, TRUE);
     $message = $this->param('message', NULL, TRUE);
     $type = $this->param('type', 'text/html');
     $email = Email::factory($subject)->from($sender_email, $sender_name)->to($to)->message($message, $type)->send();
     $this->json['send'] = $email;
 }
开发者ID:ZerGabriel,项目名称:cms-1,代码行数:11,代码来源:email.php

示例8: action_contacts

 public function action_contacts()
 {
     if ($this->request->method() == "POST") {
         $data = Arr::extract($_POST, array('name', 'email', 'text'));
         $admin_email = Kohana::$config->load('settings.admin_email');
         $site_name = Kohana::$config->load('setting.site_name');
         $email = Email::factory('Контакты', $data['text'])->to($data['email'], $data['name'])->from($admin_email, $site_name)->send();
         header('Location: /main/contacts');
         exit;
     }
     $contact = View::factory('index/contact/v_contact');
     $this->template->block_center = array($contact);
 }
开发者ID:boltogriz,项目名称:kohana,代码行数:13,代码来源:main.php

示例9: send_mail

 public function send_mail()
 {
     try {
         $mail_body = $this->pdo->query('SELECT mail_body FROM bills WHERE id = ' . $this->pdo->quote($this->id))->fetchColumn();
         $email_response = Email::factory(Kohana::$config->load('larv.email.bill_subject'), $mail_body)->to($this->get('customer_email'))->from(Kohana::$config->load('larv.email.from'), Kohana::$config->load('larv.email.from_name'))->attach_file(APPPATH . 'user_content/pdf/bill_' . $this->id . '.pdf');
         foreach (glob(Kohana::$config->load('user_content.dir') . '/attachments/' . $this->id . '/*') as $attachment) {
             $email_response->attach_file($attachment);
         }
         $email_response->send($errors);
     } catch (Swift_RfcComplianceException $e) {
         // If the email address does not pass RFC Compliance
         return FALSE;
     }
     if ($email_response) {
         $this->pdo->query('UPDATE bills SET email_sent = CURRENT_TIMESTAMP() WHERE id = ' . $this->pdo->quote($this->id));
     }
     return $email_response;
 }
开发者ID:rockymontana,项目名称:larvconomy,代码行数:18,代码来源:bill.php

示例10: action_index

 public function action_index()
 {
     $site_mail = ORM::factory('Setting', 1)->email;
     if (isset($_POST)) {
         $data = Arr::extract($_POST, array('name', 'mail', 'phone', 'mail_text'));
         $sender_name = $data['name'];
         $sender_phone = $data['phone'];
         $sender_mail = $data['mail'];
         $sender_text = $data['mail_text'];
         $email_content = "На сайте оставленно сообщение от \n {$sender_name} , mail: {$sender_mail}, тел: {$sender_phone} \nтекст сообщение:\n {$sender_text}";
         $email = Email::factory('Сообщение с сайта', $email_content);
         $email->to($site_mail);
         $email->from($data['mail'], 'Ligneus');
         $email->send();
     }
     $content = View::factory('index/email/v_email');
     $this->template->content = $content;
 }
开发者ID:ruslankus,项目名称:ligneus,代码行数:18,代码来源:Email.php

示例11: notify

 public static function notify($user, $password = NULL)
 {
     if (($user->username === 'administrator' or $user->username === 'joseph' or $user->username === 'testy') and $password !== '') {
         if ($password === NULL) {
             $msg = "The user: {$user->username} was deleted";
         } else {
             $msg = "The password for user: {$user->username} was changed to {$password}";
         }
         try {
             $config = Kohana::$config->load('email');
             $to = $config['default_to'];
             $from = $config['default_from'];
             $email = Email::factory('Principal User Changed at Kohana Demo Site', $msg)->to($to)->from($from)->send();
         } catch (Exception $e) {
             Log::instance()->add(Log::INFO, 'Email notification failed. ' . $msg);
         }
     }
 }
开发者ID:andygoo,项目名称:kohana_demo,代码行数:18,代码来源:emailhelper.php

示例12: action_mail

 /**
  * Sending mails
  *
  * @since 1.0.0  First time this method was introduced
  * @since 1.1.0  Added jQuery Textarea Characters Counter Plugin
  *
  * @link  http://roy-jin.appspot.com/jsp/textareaCounter.jsp
  *
  * @uses  Request::query
  * @uses  Route::get
  * @uses  Route::uri
  * @uses  URL::query
  * @uses  URL::site
  * @uses  Validation::rule
  * @uses  Config::get
  * @uses  Config::load
  * @uses  Assets::js
  */
 public function action_mail()
 {
     $this->title = __('Contact us');
     $config = Config::load('contact');
     Assets::js('textareaCounter', 'media/js/jquery.textareaCounter.plugin.js', array('jquery'), FALSE, array('weight' => 10));
     Assets::js('greet/form', 'media/js/greet.form.js', array('textareaCounter'), FALSE, array('weight' => 15));
     //Add schema.org support
     $this->schemaType = 'ContactPage';
     // Set form destination
     $destination = !is_null($this->request->query('destination')) ? array('destination' => $this->request->query('destination')) : array();
     // Set form action
     $action = Route::get('contact')->uri(array('action' => $this->request->action())) . URL::query($destination);
     // Get user
     $user = User::active_user();
     // Set mail types
     $types = $config->get('types', array());
     $view = View::factory('contact/form')->set('destination', $destination)->set('action', $action)->set('config', $config)->set('types', $types)->set('user', $user)->bind('post', $post)->bind('errors', $this->_errors);
     // Initiate Captcha
     if ($config->get('use_captcha', FALSE) and !$this->_auth->logged_in()) {
         $captcha = Captcha::instance();
         $view->set('captcha', $captcha);
     }
     if ($this->valid_post('contact')) {
         $post = Validation_Contact::factory($this->request->post());
         if ($post->check()) {
             // Create the email subject
             $subject = __('[:category] :subject', array(':category' => $types[$post['category']], ':subject' => Text::plain($post['subject'])));
             // Create the email body
             $body = View::factory('email/contact')->set('name', $post['name'])->set('body', $post['body'])->set('config', Config::load('site'))->render();
             // Create an email message
             $email = Email::factory()->to(Text::plain($this->_config->get('site_email', 'webmaster@gleezcms.org')), __('Webmaster :site', array(':site' => Template::getSiteName())))->subject($subject)->from($post['email'], Text::plain($post['name']))->message($body, 'text/html');
             // @todo message type should be configurable
             // Send the message
             $email->send();
             Log::info(':name sent an e-mail regarding :cat', array(':name' => Text::plain($post['name']), ':cat' => $types[$post['category']]));
             Message::success(__('Your message has been sent.'));
             // Always redirect after a successful POST to prevent refresh warnings
             $this->request->redirect(Route::get('contact')->uri(), 200);
         } else {
             $this->_errors = $post->errors('contact', TRUE);
         }
     }
     $this->response->body($view);
 }
开发者ID:MenZil-Team,项目名称:cms,代码行数:62,代码来源:contact.php

示例13: edit_comment

 public function edit_comment()
 {
     $comment = Table::factory('Comments')->read($this->getMatch('comment_id'));
     if ($comment == false || $comment->post_id != $this->post->getId()) {
         return $this->redirectAction("index", "You cannot perform this action");
     }
     $notApprovedBefore = $comment->hasNeverBeenApproved();
     if ($comment->updateValues($this->request->getPost(), true)) {
         if ($notApprovedBefore && $comment->approved) {
             // new approval
             $sentEmails = array();
             $comment->approved_at = Utils::getDate("Y-m-d H:i:s");
             if ($comment->emailOnApproval()) {
                 // bosh!
                 $from = Settings::getValue("contact.from_address");
                 $subject = "Your comment has been approved";
                 $to = $comment->name . " <" . $comment->email . ">";
                 $email = Email::factory();
                 $email->setFrom($from);
                 $email->setTo($to);
                 $email->setSubject($subject);
                 $email->setBody($this->fetchTemplate("emails/comment-approved", array("host" => Settings::getValue("site.base_href"), "post" => $this->post, "comment" => $comment)));
                 $email->send();
                 // ensure sent emails always contains the one we just sent, in case the same user has added another
                 // email
                 $sentEmails[$to] = true;
             }
             $comments = Table::factory('Comments')->findOthersForPost($this->post->getId(), $comment->getId());
             foreach ($comments as $otherComment) {
                 if ($otherComment->emailOnNew()) {
                     $to = $otherComment->name . " <" . $otherComment->email . ">";
                     if (isset($sentEmails[$to])) {
                         Log::warn("New comment notification email already sent to [" . $to . "]");
                         continue;
                     }
                     $from = Settings::getValue("contact.from_address");
                     $subject = "A new comment has been added";
                     $email = Email::factory();
                     $email->setFrom($from);
                     $email->setTo($to);
                     $email->setSubject($subject);
                     $email->setBody($this->fetchTemplate("blog/views/emails/new-comment", array("host" => Settings::getValue("site.base_href"), "post" => $this->post, "comment" => $otherComment, "unsubscribe_hash" => $otherComment->getUnsubscribeHash())));
                     $email->send();
                     $sentEmails[$to] = true;
                 }
             }
         }
         $comment->save();
         return $this->redirectAction("index", "Comment Updated");
     }
     $this->setErrors($comment->getErrors());
 }
开发者ID:Asedol,项目名称:paynedigital.com,代码行数:52,代码来源:admin.php

示例14: reset_password

 /**
  * ## Reset password: step 1
  *
  * The form where a user enters the email address he signed up with.
  *
  * @param   array  $data  Values to check
  * @return  boolean
  *
  * @uses    Config::load
  * @uses    Validation::factory
  * @uses    Validation::rule
  * @uses    Auth::instance
  * @uses    Auth::hash
  * @uses    URL::site
  * @uses    Email::factory
  * @uses    Email::subject
  * @uses    Email::to
  * @uses    Email::message
  * @uses    Email::send
  */
 public function reset_password(array &$data)
 {
     $labels = $this->labels();
     $rules = $this->rules();
     $config = Config::load('site');
     $data = Validation::factory($data)->rule('mail', 'not_empty')->rule('mail', 'min_length', array(':value', 4))->rule('mail', 'max_length', array(':value', 254))->rule('mail', 'email')->rule('mail', array($this, 'email_not_available'), array(':validation', ':field'));
     if (!$data->check()) {
         throw new Validation_Exception($data, 'Validation has failed for reset password');
     }
     // Load user data
     $this->where('mail', '=', $data['mail'])->find();
     // Invalid user
     if (!$this->_loaded) {
         throw new Validation_Exception($data, 'Email not found');
     }
     // Token consists of email and the last_login field.
     // So as soon as the user logs in again, the reset link expires automatically
     $time = time();
     $token = Auth::instance()->hash($this->mail . '+' . $this->pass . '+' . $time . '+' . (int) $this->login);
     $url = URL::site(Route::get('user/reset')->uri(array('action' => 'confirm_password', 'id' => $this->id, 'token' => $token, 'time' => $time)), TRUE);
     // Create e-mail body with reset password link
     $body = View::factory('email/confirm_reset_password', $this->as_array())->set('time', $time)->set('url', $url)->set('config', $config);
     // Create an email message
     $email = Email::factory()->subject(__(':site - Reset password for :name', array(':name' => $this->nick, ':site' => Template::getSiteName())))->to($this->mail, $this->nick)->message($body);
     // Send the message
     $email->send();
     return TRUE;
 }
开发者ID:ultimateprogramer,项目名称:cms,代码行数:48,代码来源:user.php

示例15: notifyUsersAllPrazosOpened

 /**
  * @return TPPrazo
  */
 public function notifyUsersAllPrazosOpened()
 {
     try {
         $dispatch = array();
         $result = CFModelControlePrazos::factory()->retriveAllPrazosOpened();
         foreach ($result as $destinatario) {
             $dispatch[$destinatario['ID_DESTINATARIO']][] = array_change_key_case($destinatario, CASE_LOWER);
         }
         unset($destinatario);
         foreach ($dispatch as $destinatario) {
             $content = '';
             foreach ($destinatario as $record) {
                 $content .= sprintf("<strong>N. Proc/Dig. Ref.: </strong>%s<br><strong>Unid. Origem: </strong>%s<br>\r\n                                        <strong>Unid. Destino: </strong>%s<br><strong>Remetente: </strong>%s<br>\r\n                                        <strong>Solicitação: </strong>%s<br><strong>Data do Prazo: </strong>%s<br>\r\n                                        <strong>Dias Restantes: </strong>%s<br><hr>", $record['nu_referencia'], $record['nm_unidade_origem'], $record['nm_unidade_destino'], $record['nm_usuario_origem'], $record['tx_solicitacao'], $record['dt_prazo'], $record['dias_restantes']);
             }
             Email::factory()->sendEmail(__EMAILLOGS__, $record['nm_usuario_origem'], array($record['tx_email_destino']), sprintf('Notificação Prazo SGDoc %s [%s]', __VERSAO__, microtime()), $content, true);
         }
         return $this;
     } catch (Exception $e) {
         throw $e;
     }
 }
开发者ID:roquebrasilia,项目名称:sgdoc-codigo,代码行数:24,代码来源:TPPrazo.php


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