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


PHP email::send方法代码示例

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


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

示例1: envoyer

 /**
  * Methode : page envoyer le mailing
  */
 public function envoyer()
 {
     if ($_POST) {
         $texte = $this->input->post('texte');
         $format = $this->input->post('format');
         $sujet = $this->input->post('sujet');
         $format = $format == 1 ? TRUE : FALSE;
         $users = $this->user->select();
         $nbr_envois = 0;
         foreach ($users as $user) {
             if ($format) {
                 $view = new View('mailing/template');
                 $view->name = ucfirst(mb_strtolower($user->username));
                 $view->content = $texte;
                 $message = $view->render();
             } else {
                 $message = $texte;
             }
             if (email::send($user->email, Kohana::config('email.from'), $sujet, $message, $format)) {
                 $nbr_envois++;
             }
         }
         return url::redirect('mailing?msg=' . urlencode(Kohana::lang('mailing.send_valide', number_format($nbr_envois))));
     } else {
         return parent::redirect_erreur('mailing');
     }
 }
开发者ID:ezioms,项目名称:RpgEditor,代码行数:30,代码来源:mailing.php

示例2: notify_admins

 public function notify_admins($subject = NULL, $message = NULL)
 {
     // Don't show the exceptions for this operation to the user. Log them
     // instead
     try {
         if ($subject && $message) {
             $settings = kohana::config('settings');
             $from = array();
             $from[] = $settings['site_email'];
             $from[] = $settings['site_name'];
             $users = ORM::factory('user')->where('notify', 1)->find_all();
             foreach ($users as $user) {
                 if ($user->has(ORM::factory('role', 'admin'))) {
                     $address = $user->email;
                     $message .= "\n\n\n\n~~~~~~~~~~~~\n" . Kohana::lang('notifications.admin_footer') . "\n" . url::base() . "\n\n" . Kohana::lang('notifications.admin_login_url') . "\n" . url::base() . "admin";
                     if (!email::send($address, $from, $subject, $message, FALSE)) {
                         Kohana::log('error', "email to {$address} could not be sent");
                     }
                 }
             }
         } else {
             Kohana::log('error', "email to {$address} could not be sent\n\t\t\t\t - Missing Subject or Message");
         }
     } catch (Exception $e) {
         Kohana::log('error', "An exception occured " . $e->__toString());
     }
 }
开发者ID:kjgarza,项目名称:ushahidi,代码行数:27,代码来源:notifications.php

示例3: _send_email_alert

 /**
  * Sends an email alert
  *
  * @param Validation_Core $post
  * @param Alert_Model $alert
  * @return bool 
  */
 public static function _send_email_alert($post, $alert)
 {
     if (!$post instanceof Validation_Core and !$alert instanceof Alert_Model) {
         throw new Kohana_Exception('Invalid parameter types');
     }
     // Email Alerts, Confirmation Code
     $alert_email = $post->alert_email;
     $alert_code = text::random('alnum', 20);
     $settings = kohana::config('settings');
     $to = $alert_email;
     $from = array();
     $from[] = $settings['alerts_email'] ? $settings['alerts_email'] : $settings['site_email'];
     $from[] = $settings['site_name'];
     $subject = $settings['site_name'] . " " . Kohana::lang('alerts.verification_email_subject');
     $message = Kohana::lang('alerts.confirm_request') . url::site() . 'alerts/verify?c=' . $alert_code . "&e=" . $alert_email;
     if (email::send($to, $from, $subject, $message, TRUE) == 1) {
         $alert->alert_type = self::EMAIL_ALERT;
         $alert->alert_recipient = $alert_email;
         $alert->alert_code = $alert_code;
         if (isset($_SESSION['auth_user'])) {
             $alert->user_id = $_SESSION['auth_user']->id;
         }
         $alert->save();
         self::_add_categories($alert, $post);
         return TRUE;
     }
     return FALSE;
 }
开发者ID:neumicro,项目名称:Ushahidi_Web_Dev,代码行数:35,代码来源:alert.php

示例4: _send_email_alert

 /**
  * Sends an email alert
  */
 public static function _send_email_alert($post)
 {
     // Email Alerts, Confirmation Code
     $alert_email = $post->alert_email;
     $alert_lon = $post->alert_lon;
     $alert_lat = $post->alert_lat;
     $alert_radius = $post->alert_radius;
     $alert_code = text::random('alnum', 20);
     $settings = kohana::config('settings');
     $to = $alert_email;
     $from = array();
     $from[] = $settings['alerts_email'] ? $settings['alerts_email'] : $settings['site_email'];
     $from[] = $settings['site_name'];
     $subject = $settings['site_name'] . " " . Kohana::lang('alerts.verification_email_subject');
     $message = Kohana::lang('alerts.confirm_request') . url::site() . 'alerts/verify?c=' . $alert_code . "&e=" . $alert_email;
     if (email::send($to, $from, $subject, $message, TRUE) == 1) {
         $alert = ORM::factory('alert');
         $alert->alert_type = self::EMAIL_ALERT;
         $alert->alert_recipient = $alert_email;
         $alert->alert_code = $alert_code;
         $alert->alert_lon = $alert_lon;
         $alert->alert_lat = $alert_lat;
         $alert->alert_radius = $alert_radius;
         if (isset($_SESSION['auth_user'])) {
             $alert->user_id = $_SESSION['auth_user']->id;
         }
         $alert->save();
         self::_add_categories($alert, $post);
         return TRUE;
     }
     return FALSE;
 }
开发者ID:rabbit09,项目名称:Taarifa_Web,代码行数:35,代码来源:alert.php

示例5: index

 public function index()
 {
     $db = new Database();
     $incidents = $db->query("SELECT incident.id, incident_title, \n\t\t\t\t\t\t\t\t incident_description, incident_verified, \n\t\t\t\t\t\t\t\t location.latitude, location.longitude, alert_sent.incident_id\n\t\t\t\t\t\t\t\t FROM incident INNER JOIN location ON incident.location_id = location.id\n\t\t\t\t\t\t\t\t LEFT OUTER JOIN alert_sent ON incident.id = alert_sent.incident_id");
     $config = kohana::config('alerts');
     $sms_from = NULL;
     $settings = ORM::factory('settings', 1);
     if ($settings->loaded == true) {
         // Get SMS Numbers
         if (!empty($settings->sms_no3)) {
             $sms_from = $settings->sms_no3;
         } elseif (!empty($settings->sms_no2)) {
             $sms_from = $settings->sms_no2;
         } elseif (!empty($settings->sms_no1)) {
             $sms_from = $settings->sms_no1;
         } else {
             $sms_from = "000";
         }
         // User needs to set up an SMS number
     }
     foreach ($incidents as $incident) {
         if ($incident->incident_id != NULL) {
             continue;
         }
         $verified = (int) $incident->incident_verified;
         if ($verified) {
             $latitude = (double) $incident->latitude;
             $longitude = (double) $incident->longitude;
             $proximity = new Proximity($latitude, $longitude);
             $alertees = $this->_get_alertees($proximity);
             foreach ($alertees as $alertee) {
                 $alert_type = (int) $alertee->alert_type;
                 if ($alert_type == 1) {
                     $sms = new Eflyer();
                     $sms->user = $settings->eflyer_username;
                     $sms->password = $settings->eflyer_password;
                     $sms->use_ssl = false;
                     $sms->sms();
                     $message = $incident->incident_description;
                     if ($sms->send($alertee->alert_recipient, $message) == "OK") {
                         $db->insert('alert_sent', array('alert_id' => $alertee->id, 'incident_id' => $incident->id, 'alert_date' => date("Y-m-d H:i:s")));
                         $db->clear_cache(true);
                     }
                 } elseif ($alert_type == 2) {
                     $to = $alertee->alert_recipient;
                     $from = $config['alerts_email'];
                     $subject = $incident->incident_title;
                     $message = $incident->incident_description;
                     if (email::send($to, $from, $subject, $message, TRUE) == 1) {
                         $db->insert('alert_sent', array('alert_id' => $alertee->id, 'incident_id' => $incident->id, 'alert_date' => date("Y-m-d H:i:s")));
                         $db->clear_cache(true);
                     }
                 }
             }
         }
     }
 }
开发者ID:shukster,项目名称:Cuidemos-el-Voto,代码行数:57,代码来源:alerts.php

示例6: send_password_link

 public function send_password_link($user, $key)
 {
     $message = file_get_contents("../extra/reset_password.txt");
     $replace = array("FULLNAME" => $user["fullname"], "HOSTNAME" => $_SERVER["SERVER_NAME"], "KEY" => $key);
     $email = new email("Reset password at " . $_SERVER["SERVER_NAME"], $this->settings->webmaster_email);
     $email->set_message_fields($replace);
     $email->message($message);
     $email->send($user["email"], $user["fullname"]);
 }
开发者ID:Wabuo,项目名称:monitor,代码行数:9,代码来源:password.php

示例7: email_now

function email_now($t_key, $tpl, $extra, $lang = NULL)
{
    if (SEND_EMAILS != 'true') {
        return false;
    }
    if (!isset($lang) || !$lang) {
        $lang = $language;
    }
    $tpquery = tep_db_query("SELECT * FROM email_now_templates WHERE email_template_key='{$t_key}' ORDER BY language_id!='{$lang}',language_id LIMIT 1");
    if ($tpinfo = tep_db_fetch_array($tpquery)) {
        $message = new email(array('X-Mailer: IntenseCart'));
        if (EMAIL_USE_HTML == 'true' && $tpinfo['send_mode'] == 'html') {
            $message->add_html(email_now_expand($tpinfo['email_template_html'], $tpl, 'html', ' '), email_now_expand($tpinfo['email_template_text'], $tpl));
        } else {
            $message->add_text(email_now_expand($tpinfo['email_template_text'], $tpl));
        }
        // # Send message
        $message->build_message();
        $to_name = email_now_expand($tpinfo['to_name'], $tpl, 'text', ' ');
        $to_email = email_now_expand($tpinfo['to_email'], $tpl, 'text', ' ');
        $from_name = email_now_expand($tpinfo['from_name'], $tpl, 'text', ' ');
        $from_email = email_now_expand($tpinfo['from_email'], $tpl, 'text', ' ');
        $subj = email_now_expand($tpinfo['email_subject'], $tpl, 'text', ' ');
        if (!empty($to_name)) {
            $message->send($to_name, $to_email, $from_name, $from_email, $subj);
            if (is_array($extra)) {
                foreach ($extra as $cc) {
                    $ar = array();
                    if (preg_match('/^\\s*(.*?)\\s*<\\s*(.*?)\\s*>/', $cc, $ar)) {
                        $cc_name = $ar[1];
                        $cc_email = $ar[2];
                    } else {
                        $cc_name = '';
                        $cc_email = $cc;
                    }
                    $message->send($cc_name, $cc_email, $from_name, $from_email, $subj . " [Fwd: {$to_name} <{$to_email}>]");
                }
            }
        }
    } else {
        return false;
    }
}
开发者ID:rrecurse,项目名称:IntenseCart,代码行数:43,代码来源:email_now.php

示例8: index

 public function index()
 {
     $this->template->header->this_page = 'contact';
     $this->template->content = new View('contact');
     $this->template->header->page_title .= Kohana::lang('ui_main.contact') . Kohana::config('settings.title_delimiter');
     // Setup and initialize form field names
     $form = array('contact_name' => '', 'contact_email' => '', 'contact_phone' => '', 'contact_subject' => '', 'contact_message' => '', 'captcha' => '');
     // Copy the form as errors, so the errors will be stored with keys
     // corresponding to the form field names
     $captcha = Captcha::factory();
     $errors = $form;
     $form_error = FALSE;
     $form_sent = FALSE;
     // Check, has the form been submitted, if so, setup validation
     if ($_POST) {
         // Instantiate Validation, use $post, so we don't overwrite $_POST fields with our own things
         $post = Validation::factory($_POST);
         // Add some filters
         $post->pre_filter('trim', TRUE);
         // Add some rules, the input field, followed by a list of checks, carried out in order
         $post->add_rules('contact_name', 'required', 'length[3,100]');
         $post->add_rules('contact_email', 'required', 'email', 'length[4,100]');
         $post->add_rules('contact_subject', 'required', 'length[3,100]');
         $post->add_rules('contact_message', 'required');
         $post->add_rules('captcha', 'required', 'Captcha::valid');
         // Test to see if things passed the rule checks
         if ($post->validate()) {
             // Yes! everything is valid - Send email
             $site_email = Kohana::config('settings.site_email');
             $message = Kohana::lang('ui_admin.sender') . ": " . $post->contact_name . "\n";
             $message .= Kohana::lang('ui_admin.email') . ": " . $post->contact_email . "\n";
             $message .= Kohana::lang('ui_admin.phone') . ": " . $post->contact_phone . "\n\n";
             $message .= Kohana::lang('ui_admin.message') . ": \n" . $post->contact_message . "\n\n\n";
             $message .= "~~~~~~~~~~~~~~~~~~~~~~\n";
             $message .= Kohana::lang('ui_admin.sent_from_website') . url::base();
             // Send Admin Message
             email::send($site_email, $post->contact_email, $post->contact_subject, $message, FALSE);
             $form_sent = TRUE;
         } else {
             // repopulate the form fields
             $form = arr::overwrite($form, $post->as_array());
             // populate the error fields, if any
             $errors = arr::overwrite($errors, $post->errors('contact'));
             $form_error = TRUE;
         }
     }
     $this->template->content->form = $form;
     $this->template->content->errors = $errors;
     $this->template->content->form_error = $form_error;
     $this->template->content->form_sent = $form_sent;
     $this->template->content->captcha = $captcha;
     // Rebuild Header Block
     $this->template->header->header_block = $this->themes->header_block();
     $this->template->footer->footer_block = $this->themes->footer_block();
 }
开发者ID:nemmy,项目名称:Ushahidi_Web,代码行数:55,代码来源:contact.php

示例9: reset_password

 public function reset_password()
 {
     $str = text::random($type = 'alnum', $length = 10);
     $this->password = $str;
     $subject = "Your password has been reset for " . $_SERVER['HTTP_HOST'];
     $message = "Your username is: " . $this->username . "\n\n";
     $message .= "Your new password is: " . $str . "\n\n";
     $message .= "You can reset it from the profile section of the user area";
     $this->save();
     email::send($this->email, 'admin@' . str_replace('www.', '', $_SERVER['HTTP_HOST']), $subject, $message, FALSE);
 }
开发者ID:sydlawrence,项目名称:SocialFeed,代码行数:11,代码来源:zest_user.php

示例10: send

 function send($newsletter_id)
 {
     $mail_query = smn_db_query("select customers_firstname, customers_lastname, customers_email_address from " . TABLE_CUSTOMERS . " where customers_newsletter = '1'");
     $mimemessage = new email(array('X-Mailer: oscMall bulk mailer'));
     $mimemessage->add_html($this->content);
     $mimemessage->build_message();
     while ($mail = smn_db_fetch_array($mail_query)) {
         $mimemessage->send($mail['customers_firstname'] . ' ' . $mail['customers_lastname'], $mail['customers_email_address'], '', EMAIL_FROM, $this->title);
     }
     $newsletter_id = smn_db_prepare_input($newsletter_id);
     smn_db_query("update " . TABLE_NEWSLETTERS . " set date_sent = now(), status = '1' where newsletters_id = '" . smn_db_input($newsletter_id) . "'");
 }
开发者ID:stanislauslive,项目名称:StanMarket,代码行数:12,代码来源:newsletter.php

示例11: send

 function send($affiliate_newsletter_id)
 {
     $mail_query = tep_db_query("select affiliate_firstname, affiliate_lastname, affiliate_email_address from " . TABLE_AFFILIATE . " where affiliate_newsletter = '1'");
     $mimemessage = new email(array('X-Mailer: osCmax Mailer'));
     $mimemessage->add_text($this->content);
     $mimemessage->build_message();
     while ($mail = tep_db_fetch_array($mail_query)) {
         $mimemessage->send($mail['affiliate_firstname'] . ' ' . $mail['affiliate_lastname'], $mail['affiliate_email_address'], '', EMAIL_FROM, $this->title);
     }
     $affiliate_newsletter_id = tep_db_prepare_input($affiliate_newsletter_id);
     tep_db_query("update " . TABLE_AFFILIATE_NEWSLETTERS . " set date_sent = now(), status = '1' where affiliate_newsletters_id = '" . tep_db_input($affiliate_newsletter_id) . "'");
 }
开发者ID:digideskio,项目名称:oscmax2,代码行数:12,代码来源:affiliate_newsletter.php

示例12: send_notification_email

 public function send_notification_email($job = null)
 {
     $p = unserialize($job->workload());
     fputs(STDOUT, print_r($p, true));
     fputs(STDOUT, "\nEmail\t" . $p['to']);
     $to = array($p['to'], $p['to_name']);
     $from = array(Kohana::config('email.notifcation_email_address'), Kohana::config('email.notifcation_email_name'));
     $result = email::send($to, $from, $p['subject'], $p['body'], TRUE);
     fputs(STDOUT, "Result : {$result}\n\n");
     //	$result = email::send('russell.smith@ukd1.co.uk', Kohana::config('email.notifcation_email_address'), 'KO Email test', 'debug', TRUE);
     //	fputs(STDOUT, "Result : $result\n\n");
     return $result ? GEARMAN_SUCCESS : false;
 }
开发者ID:ukd1,项目名称:Gearman-and-Kohana-example-project,代码行数:13,代码来源:gearman.php

示例13: callback

 public function callback($row)
 {
     $memObj = new \Memcached();
     foreach ($row as $value) {
         //更新缓存
         $key = 'user_' . $value['uid'];
         $memObj->set($key, json_encode($value));
         //给用户发站内信等
         $emailObj = new email();
         $emailObj->send($value['uid']);
         //.....
         //anything
     }
 }
开发者ID:dormscript,项目名称:dataTransfer,代码行数:14,代码来源:user3.php

示例14: send

 function send($newsletter_id)
 {
     $mail_query = tep_db_query("select customers_firstname, customers_lastname, customers_email_address from " . TABLE_CUSTOMERS . " where customers_newsletter = '1'");
     while ($mail = tep_db_fetch_array($mail_query)) {
         $mimemessage = new email(array('X-Mailer: osCommerce bulk mailer'));
         // Préparation de l'envoie du mail en HTML
         $mimemessage->add_html_newsletter($this->header . "\n\n" . $this->content . "\n\n" . $this->unsubscribea . " " . '<a href="' . HTTP_SERVER . DIR_WS_CATALOG . FILENAME_UNSUBSCRIBE . "?email=" . $mail['customers_email_address'] . '">' . HTTP_SERVER . DIR_WS_CATALOG . FILENAME_UNSUBSCRIBE . "?email=" . $mail['customers_email_address'] . '</a>' . "\n\n" . $this->unsubscribeb);
         $mimemessage->build_message();
         // ################# END - Contribution Newsletter v050 ##############
         $mimemessage->send($mail['customers_firstname'] . ' ' . $mail['customers_lastname'], $mail['customers_email_address'], '', EMAIL_FROM, $this->title);
     }
     $newsletter_id = tep_db_prepare_input($newsletter_id);
     tep_db_query("update " . TABLE_NEWSLETTERS . " set date_sent = now(), status = '1' where newsletters_id = '" . tep_db_input($newsletter_id) . "'");
 }
开发者ID:eosc,项目名称:EosC-2.3,代码行数:14,代码来源:newsletter.php

示例15: post

 public static function post($post)
 {
     static $posted = false;
     $arr = $post;
     if (isset($post['form_id'])) {
         unset($post['form_id']);
     }
     if (isset($post['validate'])) {
         unset($post['validate']);
     }
     $validation_array = unserialize(stripslashes($arr['validate']));
     $form = ORM::factory('form', $arr['form_id']);
     $validated = $form->validate($arr, $validation_array);
     if ($validated === true) {
     } else {
         $errors = "";
         foreach ($validated as $key => $value) {
             $errors .= "<p style='color:red'>{$value}</p>";
         }
         return array('errors' => $errors);
     }
     $to = $form->to_email;
     $domain = str_replace('www.', '', $_SERVER['HTTP_HOST']);
     $from = "noreply@" . $domain;
     $subject = "Someone has filled out the " . $form->title . " form online";
     $message = "<p>Their entries into the form were as follows:</p><table>";
     foreach ($post as $title => $value) {
         $message .= "<tr><td><b>" . str_replace('_', ' ', $title) . "</b>: </td><td>" . $value . "</td></tr>";
     }
     $message .= "</table>";
     $submission = ORM::factory('form_submission');
     $submission->form_id = $form->id;
     $submission->post = serialize($post);
     $submission->save();
     if (!$posted) {
         if (email::send($to, $from, $subject, $message, TRUE)) {
             $to = 'updates@marmaladeontoast.co.uk';
             email::send($to, $from, $subject, $message, TRUE);
             $return = $form->success_message;
         } else {
             $return = "There has been an error sending the email";
         }
     } else {
         return $posted;
     }
     $posted = $return;
     return $return;
 }
开发者ID:sydlawrence,项目名称:SocialFeed,代码行数:48,代码来源:MY_form.php


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