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


PHP sendEmail函数代码示例

本文整理汇总了PHP中sendEmail函数的典型用法代码示例。如果您正苦于以下问题:PHP sendEmail函数的具体用法?PHP sendEmail怎么用?PHP sendEmail使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: forgotpassword

 public function forgotpassword()
 {
     $data = '';
     $post = $this->input->post();
     if ($post) {
         $error = array();
         $e_flag = 0;
         if (!valid_email(trim($post['email'])) && trim($post['email']) == '') {
             $error['email'] = 'Please enter email.';
             $e_flag = 1;
         }
         if ($e_flag == 0) {
             $where = array('email' => trim($post['email']), 'role' => 'admin');
             $user = $this->common_model->selectData(ADMIN, '*', $where);
             if (count($user) > 0) {
                 $newpassword = random_string('alnum', 8);
                 $data = array('password' => md5($newpassword));
                 $upid = $this->common_model->updateData(ADMIN, $data, $where);
                 $emailTpl = $this->load->view('email_templates/admin_forgot_password', array('username' => $user[0]->name, 'password' => $newpassword), true);
                 $ret = sendEmail($user[0]->email, SUBJECT_LOGIN_INFO, $emailTpl, FROM_EMAIL, FROM_NAME);
                 if ($ret) {
                     $flash_arr = array('flash_type' => 'success', 'flash_msg' => 'Login details sent successfully.');
                 } else {
                     $flash_arr = array('flash_type' => 'error', 'flash_msg' => 'An error occurred while processing.');
                 }
                 $data['flash_msg'] = $flash_arr;
             } else {
                 $error['email'] = "Invalid email address.";
             }
         }
         $data['error_msg'] = $error;
     }
     $this->load->view('index/forgotpassword', $data);
 }
开发者ID:niravpatel2008,项目名称:ubiquitous-octo-tatertot,代码行数:34,代码来源:index.php

示例2: add_comment

function add_comment($moderator_email)
{
    $caller = strtolower($_POST["url"]);
    //$_SERVER['HTTP_REFERER'];
    $filename = md5($caller);
    $abs_comment_file = realpath('.') . '/' . $filename . '.xml';
    $date_value = time();
    $comment_id = $date_value . '-' . rand(1, 100000000);
    $author_value = processText($_POST["name"]);
    $subject_value = trim(processText($_POST["subject"]));
    $msg_value = processText($_POST["message"]);
    $email = processText($_POST["email"]);
    $site = processText($_POST["site"]);
    $title = processText($_POST["title"]);
    $parent_id = processText($_POST["id"]);
    $dom_id = processText($_POST["domid"]);
    $moderate = processText($_POST["moderate"]);
    // 0 No moderate, 1: waiting for moderate 2: trash 3: spamn 4: approved
    $max_reply = intval(processText($_POST["max"]));
    $secured = empty($_SERVER["HTTPS"]) ? '' : $_SERVER["HTTPS"] == "on" ? "s" : "";
    $protocol = strleft(strtolower($_SERVER["SERVER_PROTOCOL"]), "/") . $secured;
    $ec_path = $protocol . '://' . $_SERVER['HTTP_HOST'] . processText($_POST["path"]);
    if (empty($parent_id)) {
        $parent_id = null;
    }
    $ip = $_SERVER["REMOTE_ADDR"];
    $ret = addComment($abs_comment_file, $caller, $title, $dom_id, $comment_id, $date_value, $author_value, $subject_value, $email, $site, $msg_value, $ip, $moderate, $parent_id, $max_reply);
    $msg_value = str_replace(array("\r", "\n"), "<br />", $msg_value);
    echo json_encode(array("id" => $comment_id, "comment" => '<li class="ec-comment" id="' . $comment_id . '">' . '   <div class="avatar"></div>' . '   <span class="user-name author">' . $author_value . '</span> <br/>' . '   <span class="comment-html">' . (empty($subject_value) ? '' : '      <strong>' . $subject_value . '</strong><br /><br />') . $msg_value . '   </span><br/>' . '   <span class="comment-time">' . ago(time() - $date_value * 1) . '</span><br/>' . ($ret ? '   <button name="reply" id="reply_' . $comment_id . '">Reply</button>' : "") . '</li>'));
    // send email to moderator
    if ($moderate == "1") {
        $body = 'A new comment is waiting for your approval:<br /><br />' . 'Author:' . $author_value . '(IP: ' . $ip . ')<br/>' . 'Email:' . $email . '<br/>' . 'URL:' . $site . '<br/>' . 'Subject:' . $subject_value . '<br/>' . 'Whois:<a href="http://whois.arin.net/rest/ip/' . $ip . '" target="_blank">http://whois.arin.net/rest/ip/' . $ip . '</a><br/>' . 'Comment:<br/>' . '<blockquote>' . $msg_value . '</blockquote><br/>' . 'To moderate this message, click <a href="' . $ec_path . 'ec-dashboard.html">' . $ec_path . 'ec-dashboard.html</a><br/>' . '<br/>' . 'Thanks for choosing EastComment<br/><br/>' . '<a href="http://www.jswidget.com/lab/easy-comment.html" target="_blank">http://www.jswidget.com/lab/easy-comment.html</a>';
        sendEmail($moderator_email, $body);
    }
}
开发者ID:rahul1205,项目名称:summerproject,代码行数:35,代码来源:ec-comment.php

示例3: register

 public function register()
 {
     //完成注册,注册完成发送一封激活邮件
     if (IS_POST) {
         $model = new \Model\UserModel();
         if ($data = $model->create()) {
             $validate = uniqid();
             $data['validate'] = $validate;
             if ($model->add($data)) {
                 //注册成功,发送邮件激活
                 $email = I('post.email');
                 $title = '注册用户,完成激活';
                 $url = "http://web.com/index.php/Home/User/active/key/" . $validate . "/email/" . $email;
                 $content = "亲,您已注册成功,赶紧激活使用吧!请<a href='{$url}'>单击激活</a>";
                 if (sendEmail($email, $content, $title)) {
                     $this->success('邮件发送成功,请尽快激活', U('login'), 1);
                     exit;
                 }
                 $this->error('发送邮件失败,请重新注册');
             }
             $this->error('注册失败');
         }
         $this->error($model->getError());
     }
     $this->display();
 }
开发者ID:VenusGrape,项目名称:hymall,代码行数:26,代码来源:UserController.class.php

示例4: sendUserLogsViaMail

function sendUserLogsViaMail($classID)
{
    $conn = getMainConnection();
    $query = "SELECT * FROM info WHERE ID = '" . $classID . "'";
    $result = mysql_query($query);
    $numrows = mysql_affected_rows();
    if ($numrows == 1) {
        $member = mysql_fetch_array($result);
        if ($member['activeflag'] != 0) {
            getTemporaryConnection($member['databasename']);
        }
    }
    $query = "SELECT * FROM login_logs WHERE lastlogin <= '" . time() . "' AND lastlogin >= '" . (time() - 86400) . "'";
    $result = mysql_query($query);
    $mail_string = '';
    while ($member = mysql_fetch_array($result)) {
        $time = date("F j, Y, g:i a", $member['lastlogin']);
        $user = getUser($member['userID'])->getName();
        $mail_string .= $user . ' logged in at ' . $time . ' from the ip ' . $member['ip'] . '<br />';
    }
    //echo $mail_string;
    $toEmail = 'acechemistry2@gmail.com';
    $toName = 'Ace Chemistry';
    $fromEmail = 'noreply@knowledgeportal.in';
    $fromName = 'My Class - Knowledge Portal';
    $subject = 'Staff Login Logs : ' . date("d-m-Y");
    $body = 'Staff Login Logs <hr /><br />' . $mail_string;
    $flag = sendEmail($toEmail, $toName, $fromEmail, $fromName, $subject, $body, '');
    return $flag;
}
开发者ID:harshselani,项目名称:My-Class,代码行数:30,代码来源:emailfunctions.php

示例5: addUser

function addUser($email, $first_name, $last_name, $phone, $address, $town, $organization, $country, $zip, $october6, $october7, $october8, $october9, $october10, $msg_email, $msg_phone)
{
    $db = getDb();
    //$db->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION );
    try {
        $stmt = $db->prepare('INSERT INTO users (email, first_name, last_name, phone, address, town, organization, country, zip, october6, october7, october8, october9, october10, msg_email, msg_phone)
							VALUES ("' . $email . '", "' . $first_name . '", "' . $last_name . '", "' . $phone . '", "' . $address . '", "' . $town . '", "' . $organization . '", "' . $country . '", "' . $zip . '", ' . $october6 . ', ' . $october7 . ', ' . $october8 . ', ' . $october9 . ', ' . $october10 . ', ' . $msg_email . ', ' . $msg_phone . ')');
        //	$stmt = $db->prepare('INSERT INTO users (email, first_name, last_name, phone, address, town, organization, country, zip, october6, october7, october8, october9, october10, msg_email, msg_phone)
        //							VALUES ("' . $email .'", "' . $first_name .'", "' . $last_name .'", "' . $phone .'", "' . $address .'", "' . $town .'", "' . $organization .'", "' . $country .'", "' . $zip .'", true, false, true, true, false, true, true)');
        /*$stmt->bindValue(':email', $email, PDO::PARAM_STR);
        	$stmt->bindValue(':first_name', $first_name, PDO::PARAM_STR);
        	$stmt->bindValue(':last_name', $last_name, PDO::PARAM_STR);
        	$stmt->bindValue(':phone', $phone, PDO::PARAM_STR);
        	$stmt->bindValue(':address', $address, PDO::PARAM_STR);
        	$stmt->bindValue(':town', $town, PDO::PARAM_STR);
        	$stmt->bindValue(':organization', $organization, PDO::PARAM_STR);
        	$stmt->bindValue(':country', $country, PDO::PARAM_STR);
        	$stmt->bindValue(':zip', $zip, PDO::PARAM_STR);
        	$stmt->bindValue(':october6', $october6, PDO::PARAM_BOOL);
        	$stmt->bindValue(':october7', $october7, PDO::PARAM_BOOL);
        	$stmt->bindValue(':october8', $october8, PDO::PARAM_BOOL);
        	$stmt->bindValue(':october9', $october9, PDO::PARAM_BOOL);
        	$stmt->bindValue(':october10', $october10, PDO::PARAM_STR);
        	$stmt->bindValue(':msg_email', $msg_email, PDO::PARAM_BOOL);
        	$stmt->bindValue(':msg_phone', $msg_phone, PDO::PARAM_BOOL); */
        $stmt->execute();
        // TODO: This does not work, please fix
    } catch (PDOException $e) {
        //		echo $e->getMessage();
    }
    sendEmail($first_name, $last_name, $october6, $october7, $october8, $october9, $october10, $email);
    //	print_r($db->errorInfo());
}
开发者ID:CarlTaylor1989,项目名称:sap-intel-vrst,代码行数:33,代码来源:register.php

示例6: registration

  function registration()
  {
      $this->loadModel('User');
      $this->loadModel('Role');
      if ($this->request->is('post')) {
          $this->User->set($this->request->data);
          if ($this->User->validates()) {
              //$this->request->data['User']['password'] = md5($this->request->data['User']['password']);
              $mail_data = $this->User->save($this->request->data);
              // send mail :
              $from = $mail_data['User']['email'];
              $subject = "New technician registration";
              $user_name = $mail_data['User']['name'];
              $email_user = $mail_data['User']['email'];
              $password = $this->request->data['User']['password'];
              $role_id = $mail_data['User']['role_id'];
              $to = array('info@totalcableusa.com', 'sattar.kuet@gmail.com', 'rjasoft@gmail.com');
              $mail_content = __('Name:', 'beopen') . $user_name . PHP_EOL . __('Email:', 'beopen') . $email_user . PHP_EOL . __('Password:', 'beopen') . $password . PHP_EOL . __('Role Id:', 'beopen') . $role_id . PHP_EOL . __($url = Router::url(array("controller" => "users", "action" => "login"), true));
              sendEmail($from, $user_name, $to, $subject, $mail_content);
              // End send mail
              $msg = '<div class="alert alert-success">
 <button type="button" class="close" data-dismiss="alert">&times;</button>
 <strong> User Created succeesfully </strong>
 </div>';
          } else {
              $msg = $this->generateError($this->User->validationErrors);
          }
          $this->Session->setFlash($msg);
          // return $this->redirect('create');
      }
      $this->set('roles', $this->Role->find("list"));
  }
开发者ID:sattar-kuet,项目名称:totalCable,代码行数:32,代码来源:UsersController111215.php

示例7: _request_new_password

function _request_new_password()
{
    if (isset($_POST['email'])) {
        $user = new User(getdbh());
        $ID = $user->checkEmail($_POST['email']);
        if (isset($ID['ID'])) {
            $setToken = $user->setRecover($ID['ID'], $_POST['email']);
            if ($setToken != false) {
                $body = 'Pentru a schimba parola apasa   <a href="' . WEB_DOMAIN . WEB_FOLDER . 'ops/recover_password/' . $setToken . '"> AICI </a>';
                if (sendEmail('Schimbare parola', $body, 'ulbsPlatform@ebs.ro', $_POST['email'])) {
                    $data['msg'][] = "Emailul cu linkul de resetare a parolei a fost trimis";
                    View::do_dump(VIEW_PATH . 'layout.php', $data);
                } else {
                    $data['msg'][] = "Emailul nu a fost trimis";
                    View::do_dump(VIEW_PATH . 'layout.php', $data);
                }
            } else {
                $data['msg'][] = "Tokenul este gresit sau au trecut mai mult de 2 zile de la cererea de recuperare parola";
                View::do_dump(VIEW_PATH . 'layout.php', $data);
            }
        } else {
            $data['msg'][] = "Acest user nu exista";
            View::do_dump(VIEW_PATH . 'layout.php', $data);
        }
    } else {
        redirect('main/index');
    }
}
开发者ID:laiello,项目名称:ebs-academy-at-ulbs-2014,代码行数:28,代码来源:request_new_password.php

示例8: main

function main($contactForm)
{
    // Checks if something was sent to the contact form, if not, do nothing
    if (!$contactForm->isDataSent()) {
        return;
    }
    // validates the contact form and initialize the errors
    $contactForm->validate();
    $errors = array();
    // if the contact form is not valid...
    if (!$contactForm->isValid()) {
        // gets the error in the array $errors
        $errors = $contactForm->getErrors();
    } else {
        // if the contact form is valid...
        try {
            // send the email created with the contact form
            $result = sendEmail($contactForm);
            // after the email is sent, redirect and "die".
            // We redirect to prevent refreshing the page which would resend the form
            header("Location: ./success.php");
            die;
        } catch (Exception $e) {
            // an error occured while sending the email.
            // Log the error and add an error message to display to the user.
            error_log('An error happened while sending email contact form: ' . $e->getMessage());
            $errors['oops'] = 'Ooops! an error occured while sending your email! Please try again later!';
        }
    }
    return $errors;
}
开发者ID:chavezjude7,项目名称:Jude-Chavez,代码行数:31,代码来源:composer.php

示例9: _newUser

function _newUser()
{
    $user = new User(getdbh());
    $email = $user->checkEmail($_POST['email']);
    if (isset($email['ID'])) {
        $data['msg'][] = " Acest email nu este disponibil! Va rugam alegeti altul!";
        $data['redirect'][] = 'main/new';
        View::do_dump(VIEW_PATH . 'layout.php', $data);
    } else {
        $result = $user->addUser($_POST['email'], $_POST['password1'], $_POST['nume'], $_POST['prenume']);
        if ($result > 0) {
            $setToken = $user->newUserToken($result);
            if ($setToken != false) {
                $body = 'Pentru a activa contul apasa   <a href="' . WEB_DOMAIN . WEB_FOLDER . 'ops/newUserToken/' . $setToken . '"> AICI </a>';
                if (sendEmail('Email confirmare cont', $body, 'ulbsPlatform@ebs.ro', $_POST['email'])) {
                    $data['msg'][] = "Emailul cu linkul de confirmare cont a fost trimis";
                    $data['redirect'][] = 'main/index';
                    View::do_dump(VIEW_PATH . 'layout.php', $data);
                } else {
                    $data['msg'][] = "Emailul cu linkul de confirmare nu a fost trimis";
                    $data['redirect'][] = 'main/index';
                    View::do_dump(VIEW_PATH . 'layout.php', $data);
                }
            } else {
                $data['msg'][] = "Eroare la generarea tokenului";
                $data['redirect'][] = 'main/index';
                View::do_dump(VIEW_PATH . 'layout.php', $data);
            }
        } else {
            $data['msg'][] = "Eroare la crearea contului!";
            $data['redirect'][] = 'main/index';
            View::do_dump(VIEW_PATH . 'layout.php', $data);
        }
    }
}
开发者ID:laiello,项目名称:ebs-academy-at-ulbs-2014,代码行数:35,代码来源:newUser.php

示例10: __construct

 function __construct()
 {
     $guid = getInput("guid");
     $reply = getInput("reply");
     if (!$reply) {
         new SystemMessage("Message body cannot be left empty.");
         forward();
     }
     $message = getEntity($guid);
     $to = getLoggedInUserGuid() == $message->to ? $message->from : $message->to;
     $from = getLoggedInUserGuid();
     $to_user = getEntity($to);
     $from_user = getEntity($from);
     $message_element = new Messageelement();
     $message_element->message = $reply;
     $message_element->to = $to;
     $message_element->from = $from;
     $message_element->container_guid = $guid;
     $message_element->save();
     $link = getSiteURL() . "messages";
     notifyUser("message", $to, getLoggedInUserGuid(), $to);
     sendEmail(array("to" => array("name" => $to_user->full_name, "email" => $to_user->email), "from" => array("name" => getSiteName(), "email" => getSiteEmail()), "subject" => "You have a new message from " . getLoggedInUser()->full_name, "body" => "You have received a new message from " . getLoggedInUser()->full_name . "<br/><a href='{$link}'>Click here to view it.</a>", "html" => true));
     new SystemMessage("Your message has been sent.");
     forward("messages/" . $message->guid);
 }
开发者ID:socialapparatus,项目名称:socialapparatus,代码行数:25,代码来源:MessageReplyActionHandler.php

示例11: add

 /**
  * subscribe a user
  * @param object http request
  * @return bool
  */
 public function add(\applications\modules\users\entities\usersEntity $user)
 {
     //check if the email exists
     if (!$this->checkEmailExists($user->getEmail())) {
         if (ENABLE_MAIL_REGISTRATION == 1) {
             $user->setLevel(rand(100000, 999999));
             $user->setActive(0);
         } else {
             $user->setLevel(1);
             $user->setActive(1);
         }
         //try to save in db
         if ($this->currentManager->save($user)) {
             //send email
             $dest = $user->getEmail();
             $subject = WEBSITE_TITLE . ' - Activez votre compte';
             $msg = '<body><head></head><body><div style="width : 100%;height : 550px;padding : 25px;background-color : #EFEFEF"><div style="padding : 20px;width : 450px;margin-left: auto;margin-right: auto;background-color: #ffffff !important;box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3), 0 3px 8px rgba(0, 0, 0, 0.2);"><h2 style="color: #428bca !important;">Bonjour ' . $user->getName() . ' et bienvenue</h2><hr/>Votre compte est activ&eacute;, connectez-vous et rejoignez les nombreux ateliers propos&eacute;s.<br/><br/>Si vous rencontrez le moindre probl&egrave;me, n&#39;h&eacute;sitez pas &agrave; nous contacter &agrave; l&#39;adresse suivante : contact.agoraexmachina@gmail.com<br/><br/><br/><br/><p style="color: #555555 !important;">L&#39;&eacute;quipe AGORA Ex Machina.</p></div></div></body></body>';
             try {
                 sendEmail($dest, $subject, $msg);
                 return true;
             } catch (\Exception $e) {
                 \library\handleErrors::setErrors($this->errorSendEmail);
             }
         } else {
             \library\handleErrors::setErrors($this->errorSaveInDb);
         }
     } else {
         \library\handleErrors::setErrors($this->errorExistingElement);
     }
     return false;
 }
开发者ID:ThomasSchweizer,项目名称:agoraexmachina,代码行数:36,代码来源:usersService.class.php

示例12: notificaPrazoUsuario

function notificaPrazoUsuario()
{
    if (acesso()) {
        sendEmail();
    }
    return true;
}
开发者ID:roquebrasilia,项目名称:sgdoc-codigo,代码行数:7,代码来源:notificar_prazo_usuario.php

示例13: process

 public function process()
 {
     $content = nl2br($this->getElementValue('body'));
     $content .= '<br /><br /><small>This is NOT an automated email, a human wrote this email and sent it to you directly from lanlist.org. We try not to spam our users and hope you found this email useful. If you REALLY hate us and want to stop receiving email from us then login to http://lanlist.org and remove your email address from your user profile. You should be able to reply to this email and talk to a human, or check http://lanlist.org/contact.php for our latest contact details. </small>';
     $subject = $this->getElementValue('subject');
     sendEmail($this->getElementValue('email'), $content, $subject, false);
     redirect('listUsers.php?', 'Email sent.');
 }
开发者ID:jamesread,项目名称:lanlist.org,代码行数:8,代码来源:FormSendEmailToUser.php

示例14: sendEmail_log

function sendEmail_log($log_html_url)
{
    $to = "icerrr@rejh.nl";
    $subject = "Icerrr log";
    $message = "Hi,\n\nA new log has been uploaded:\n" . $log_html_url . "\n\nOr check: \nhttp://www.rejh.nl/icerrr/api/logs_users/read.php \n\nGreetings,\n\nIcerrr Mailer";
    $headers = 'From: noreply-icerrr@rejh.nl' . "\r\n" . 'Reply-To: noreply-icerrr@rejh.nl' . "\r\n" . 'X-Mailer: PHP/' . phpversion();
    sendEmail($to, $subject, $message, $headers, false);
}
开发者ID:FXDigitalNetworks,项目名称:icerrr,代码行数:8,代码来源:s.functions.php

示例15: executeSendsubmit

 function executeSendsubmit()
 {
     global $template, $WebBaseDir, $ClassDir, $controller, $i18n, $ActiveOption, $LU;
     require_once $ClassDir . "SendEmail.php";
     $arr = sendEmail(trim($_POST['to']), $LU->getProperty("email"), $LU->getProperty("handle"), $LU->getProperty("email"), trim($_POST['title']), trim($_POST['content']), trim($_POST['content']));
     $template->setFile(array("MAIN" => "apf_mail_write.html"));
     $template->setBlock("MAIN", "edit_block");
     $template->setVar(array("WEBDIR" => $WebBaseDir, "SENT_MSG" => "<h2>" . $arr["msg"] . "</h2>", "SUCCESS_CLASS" => "save-ok", "TEXTAREACONTENT" => textareaTag("content", "", true), "DOACTION" => "sendsubmit"));
 }
开发者ID:BackupTheBerlios,项目名称:flushcms,代码行数:9,代码来源:MailSender.class.php


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