コード例 #1
0
ファイル: cmUser.class.php プロジェクト: sbeam/cshop
    /**
     * send an email to this userperson 
     * with an MD5 key that can be used to begin password change process
     * @return success
     * @todo make the format of the email in a template somehow...
     */
    function send_pass_notification($forced = false)
    {
        $site = SITE_DOMAIN_NAME;
        $user = $this->fetch();
        $mash = $user['token'];
        $recip = sprintf('%s <%s>', $this->get_full_name(), $this->get_email());
        $bcc = $this->order_confirm_bcc;
        $link = sprintf('http://%s' . CSHOP_PASS_RECOVER_LINK_FMT, $_SERVER['HTTP_HOST'], $user['id'], $mash);
        $sender = EMAIL_SENDER;
        $headers = sprintf("From: %s Web <{$sender}>\n", SITE_DOMAIN_NAME);
        $headers .= "X-Sender: <{$sender}>\n";
        $headers .= "Return-Path: <{$sender}>\n";
        // Return path for errors
        $headers .= "BCC: {$bcc}\n";
        $msg = "This is an automatic message from {$site}.";
        if ($forced) {
            $msg .= "\n                Account information for you has just been added to added to the {$site}\n                website. In order to login, please click on the link below\n                - you will be taken to a page where you can choose a password for your\n                account and then login and begin shopping at {$site}!\n                ";
        } else {
            $msg .= "\n                Someone has requested to change the password for the user account with this\n                email address. If you have requested this, please click on the link below -\n                you will be taken to a page where you can update your password and other\n                account information:\n                ";
        }
        $msg .= <<<EOM

         *********************************************************************

         {$link}

         *********************************************************************

        (If you cannot click on the above link or it does not open a browser
        window, just copy the entire line above, making sure to include all
        characters, into your browser's 'Go to:' or 'Location:' bar.)

        If you did not request this action, simply delete this message. No futher
        action will be taken and your password to the site will not be
        changed.

        This message was sent to "{$recip}". 
        If you have any questions about or problems with this service, send us
        a message at [{$sender}]

EOM;
        //'
        $msg = preg_replace("/^ *(.*)/m", "\\1", $msg);
        //remove left-side spaces from all the lines in msg
        $subj = sprintf('%s: Account Change Request', SITE_DOMAIN_NAME);
        $cm = new circusMailer();
        return $cm->send($recip, $subj, $msg);
    }
コード例 #2
0
ファイル: cmProduct.class.php プロジェクト: sbeam/cshop
 /**
  * send a notice to somebody
  */
 function _send_inventory_warning_notice($inv_id, $qty)
 {
     if (defined('CSHOP_INVENTORY_WARNING_RECIP')) {
         $recip = ON_LIVE_SERVER ? CSHOP_INVENTORY_WARNING_RECIP : ERROR_EMAIL_RECIP;
         $cmail = new circusMailer();
         $attr = $this->get_attrib_array($inv_id);
         $product = $this->fetch(array('title', 'sku'));
         $subj = SITE_DOMAIN_NAME . " - Inventory Warning";
         $msg = "Inventory levels are at or below the configured warning level for the following item:\n";
         $msg .= "\tProduct name:" . $product['title'] . "\n";
         $msg .= "\tSKU:" . $product['sku'] . "\n";
         foreach ($attr as $k => $v) {
             $msg .= "\t{$k}: {$v}\n";
         }
         $msg .= "\tQuantity on hand: {$qty}\n";
         return $cmail->send($recip, $subj, $msg);
     }
 }