• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP SugarPHPMailer类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: canSendPassword

function canSendPassword()
{
    require_once 'include/SugarPHPMailer.php';
    global $mod_strings;
    global $current_user;
    global $app_strings;
    $mail = new SugarPHPMailer();
    $emailTemp = new EmailTemplate();
    $mail->setMailerForSystem();
    $emailTemp->disable_row_level_security = true;
    if ($current_user->is_admin) {
        if ($emailTemp->retrieve($GLOBALS['sugar_config']['passwordsetting']['generatepasswordtmpl']) == '') {
            return $mod_strings['LBL_EMAIL_TEMPLATE_MISSING'];
        }
        if (empty($emailTemp->body) && empty($emailTemp->body_html)) {
            return $app_strings['LBL_EMAIL_TEMPLATE_EDIT_PLAIN_TEXT'];
        }
        if ($mail->Mailer == 'smtp' && $mail->Host == '') {
            return $mod_strings['ERR_SERVER_SMTP_EMPTY'];
        }
        $email_errors = $mod_strings['ERR_EMAIL_NOT_SENT_ADMIN'];
        if ($mail->Mailer == 'smtp') {
            $email_errors .= "<br>-" . $mod_strings['ERR_SMTP_URL_SMTP_PORT'];
        }
        if ($mail->SMTPAuth) {
            $email_errors .= "<br>-" . $mod_strings['ERR_SMTP_USERNAME_SMTP_PASSWORD'];
        }
        $email_errors .= "<br>-" . $mod_strings['ERR_RECIPIENT_EMAIL'];
        $email_errors .= "<br>-" . $mod_strings['ERR_SERVER_STATUS'];
        return $email_errors;
    } else {
        return $mod_strings['LBL_EMAIL_NOT_SENT'];
    }
}
开发者ID:delkyd,项目名称:sugarcrm_dev,代码行数:34,代码来源:password_utils.php


示例2: sendReminders

 /**
  * send reminders
  * @param SugarBean $bean
  * @param Administration $admin
  * @param array $recipients
  * @return boolean
  */
 protected function sendReminders(SugarBean $bean, Administration $admin, $recipients)
 {
     global $sugar_config;
     $user = new User();
     $user->retrieve($bean->created_by);
     $OBCharset = $GLOBALS['locale']->getPrecedentPreference('default_email_charset');
     ///////////////////EMAIL///////////////////////////
     require_once "include/SugarPHPMailer.php";
     $mail = new SugarPHPMailer();
     $mail->setMailerForSystem();
     if (empty($admin->settings['notify_send_from_assigning_user'])) {
         $from_address = $admin->settings['notify_fromaddress'];
         $from_name = $admin->settings['notify_fromname'] ? "" : $admin->settings['notify_fromname'];
     } else {
         $from_address = $user->emailAddress->getReplyToAddress($user);
         $from_name = $user->full_name;
     }
     $mail->From = $from_address;
     $mail->FromName = $from_name;
     $mail->Body = "Напоминание о сделке '{$bean->name}' - {$sugar_config['site_url']}/index.php?action=DetailView&module=Opportunities&record={$bean->id}";
     $mail->Subject = "SugarCRM::Напоминание о сделке";
     $oe = new OutboundEmail();
     $oe = $oe->getSystemMailerSettings();
     if (empty($oe->mail_smtpserver)) {
         $GLOBALS['log']->fatal("Email Reminder: error sending email, system smtp server is not set");
         return;
     }
     foreach ($recipients as $r) {
         $mail->ClearAddresses();
         $mail->AddAddress($r['email'], $GLOBALS['locale']->translateCharsetMIME(trim($r['name']), 'UTF-8', $OBCharset));
         $mail->prepForOutbound();
         if (!$mail->Send()) {
             $GLOBALS['log']->fatal("Email Reminder: error sending e-mail (method: {$mail->Mailer}), (error: {$mail->ErrorInfo})");
         }
     }
     ///////////////////SMS///////////////////////////
     require_once 'custom/sms/sms.php';
     $sms = new sms();
     $sms->parent_type = 'Users';
     foreach ($recipients as $r) {
         $sms->parent_id = $r['id'];
         $sms->pname = $r['name'];
         $type = "Напоминание о сделке ";
         $text = $type . $bean->name;
         /*if($sms->send_message($r['number'], $text) == "SENT")
         		return true;
                   else
         		return false;*/
     }
     ///////////////////ALERT/////////////////////////// !TODO
     /*$timeStart = strtotime($db->fromConvert($bean->date_start, 'datetime'));
     		$this->addAlert($app_strings['MSG_JS_ALERT_MTG_REMINDER_CALL'], $bean->name, $app_strings['MSG_JS_ALERT_MTG_REMINDER_TIME'].$timedate->to_display_date_time($db->fromConvert($bean->date_remind, 'datetime')) , $app_strings['MSG_JS_ALERT_MTG_REMINDER_DESC'].$bean->description. $app_strings['MSG_JS_ALERT_MTG_REMINDER_CALL_MSG'] , $timeStart - strtotime($this->now), 'index.php?action=DetailView&module=Opportunities&record=' . $bean->id);
     		*/
     return true;
 }
开发者ID:omusico,项目名称:sugar_work,代码行数:62,代码来源:Reminder.php


示例3: notify_on_delete

 public function notify_on_delete($bean, $event, $arguments)
 {
     //Send an email to the department manager
     require_once "include/SugarPHPMailer.php";
     $email_obj = new Email();
     $defaults = $email_obj->getSystemDefaultEmail();
     $mail = new SugarPHPMailer();
     $mail->setMailerForSystem();
     $mail->From = $defaults["email"];
     $mail->FromName = $defaults["name"];
     $mail->Subject = "Account record deleted";
     $mail->Body = "The account record with ID: " . $bean->id . ", Name: " . $bean->name . ", Address: " . $bean->billing_address_street . ", " . $bean->billing_address_city . ", " . $bean->billing_address_state . ", " . $bean->billing_address_postalcode . ", " . $bean->billing_address_country . " is being deleted.";
     $mail->prepForOutbound();
     $mail->AddAddress("[email protected]");
     @$mail->Send();
 }
开发者ID:mihir-parikh,项目名称:sugarcrm_playground,代码行数:16,代码来源:AccountHooks.php


示例4: sendSugarPHPMail

function sendSugarPHPMail($tos, $subject, $body)
{
    require_once 'include/SugarPHPMailer.php';
    require_once 'modules/Administration/Administration.php';
    global $current_user;
    $mail = new SugarPHPMailer();
    $admin = new Administration();
    $admin->retrieveSettings();
    if ($admin->settings['mail_sendtype'] == "SMTP") {
        $mail->Host = $admin->settings['mail_smtpserver'];
        $mail->Port = $admin->settings['mail_smtpport'];
        if ($admin->settings['mail_smtpauth_req']) {
            $mail->SMTPAuth = TRUE;
            $mail->Username = $admin->settings['mail_smtpuser'];
            $mail->Password = $admin->settings['mail_smtppass'];
        }
        $mail->Mailer = "smtp";
        $mail->SMTPKeepAlive = true;
    } else {
        $mail->mailer = 'sendmail';
    }
    $mail->IsSMTP();
    // send via SMTP
    if ($admin->settings['mail_smtpssl'] == '2') {
        $mail->SMTPSecure = "tls";
    } elseif ($admin->settings['mail_smtpssl'] == '1') {
        $mail->SMTPSecure = "ssl";
    }
    $mail->CharSet = 'UTF-8';
    $mail->From = $admin->settings['notify_fromaddress'];
    $mail->FromName = $admin->settings['notify_fromname'];
    $mail->ContentType = "text/html";
    //"text/plain"
    $mail->IsHTML(true);
    $mail->Subject = $subject;
    $mail->Body = $body;
    foreach ($tos as $name => $address) {
        $mail->AddAddress("{$address}", "{$name}");
    }
    if (!$mail->send()) {
        $GLOBALS['log']->info("sendSugarPHPMail - Mailer error: " . $mail->ErrorInfo);
        return false;
    } else {
        return true;
    }
}
开发者ID:omusico,项目名称:sugar_work,代码行数:46,代码来源:send_mail.php


示例5: SendEmail

 function SendEmail($emailsTo, $emailSubject, $emailBody)
 {
     $emailObj = new Email();
     $defaults = $emailObj->getSystemDefaultEmail();
     $mail = new SugarPHPMailer();
     $mail->setMailerForSystem();
     $mail->From = $defaults['email'];
     $mail->FromName = $defaults['name'];
     $mail->ClearAllRecipients();
     $mail->ClearReplyTos();
     $mail->Subject = from_html($emailSubject);
     $mail->Body = $emailBody;
     $mail->AltBody = from_html($emailBody);
     $mail->prepForOutbound();
     foreach ($emailsTo as &$value) {
         $mail->AddAddress($value);
     }
     if (@$mail->Send()) {
     }
 }
开发者ID:julieth756,项目名称:SugarCRMLogicHooks,代码行数:20,代码来源:OpportunitiesHooks.php


示例6: sendEmail

 function sendEmail($emailTo, $emailSubject, $emailBody, $altemailBody, SugarBean $relatedBean = null)
 {
     require_once 'modules/Emails/Email.php';
     require_once 'include/SugarPHPMailer.php';
     $emailObj = new Email();
     $emailSettings = getPortalEmailSettings();
     $mail = new SugarPHPMailer();
     $mail->setMailerForSystem();
     $mail->From = $emailSettings['from_address'];
     $mail->FromName = $emailSettings['from_name'];
     $mail->ClearAllRecipients();
     $mail->ClearReplyTos();
     $mail->Subject = from_html($emailSubject);
     $mail->Body = $emailBody;
     $mail->AltBody = $altemailBody;
     $mail->prepForOutbound();
     $mail->AddAddress($emailTo);
     //now create email
     if (@$mail->Send()) {
         $emailObj->to_addrs = '';
         $emailObj->type = 'archived';
         $emailObj->deleted = '0';
         $emailObj->name = $mail->Subject;
         $emailObj->description = $mail->AltBody;
         $emailObj->description_html = $mail->Body;
         $emailObj->from_addr = $mail->From;
         if ($relatedBean instanceof SugarBean && !empty($relatedBean->id)) {
             $emailObj->parent_type = $relatedBean->module_dir;
             $emailObj->parent_id = $relatedBean->id;
         }
         $emailObj->date_sent = TimeDate::getInstance()->nowDb();
         $emailObj->modified_user_id = '1';
         $emailObj->created_by = '1';
         $emailObj->status = 'sent';
         $emailObj->save();
     }
 }
开发者ID:BMLP,项目名称:memoryhole-ansible,代码行数:37,代码来源:updatePortal.php


示例7: run

    public function run($data)
    {
        global $sugar_config, $timedate;
        $bean = BeanFactory::getBean('AOR_Scheduled_Reports', $data);
        $report = $bean->get_linked_beans('aor_report', 'AOR_Reports');
        if ($report) {
            $report = $report[0];
        } else {
            return false;
        }
        $html = "<h1>{$report->name}</h1>" . $report->build_group_report();
        $html .= <<<EOF
        <style>
        h1{
            color: black;
        }
        .list
        {
            font-family: "Lucida Sans Unicode", "Lucida Grande", Sans-Serif;font-size: 12px;
            background: #fff;margin: 45px;width: 480px;border-collapse: collapse;text-align: left;
        }
        .list th
        {
            font-size: 14px;
            font-weight: normal;
            color: black;
            padding: 10px 8px;
            border-bottom: 2px solid black};
        }
        .list td
        {
            padding: 9px 8px 0px 8px;
        }
        </style>
EOF;
        $emailObj = new Email();
        $defaults = $emailObj->getSystemDefaultEmail();
        $mail = new SugarPHPMailer();
        /*$result = $report->db->query($report->build_report_query());
          $reportData = array();
          while($row = $report->db->fetchByAssoc($result, false))
          {
              $reportData[] = $row;
          }
          $fields = $report->getReportFields();
          foreach($report->get_linked_beans('aor_charts','AOR_Charts') as $chart){
              $image = $chart->buildChartImage($reportData,$fields,false);
              $mail->AddStringEmbeddedImage($image,$chart->id,$chart->name.".png",'base64','image/png');
              $html .= "<img src='cid:{$chart->id}'>";
          }*/
        $mail->setMailerForSystem();
        $mail->IsHTML(true);
        $mail->From = $defaults['email'];
        $mail->FromName = $defaults['name'];
        $mail->Subject = from_html($bean->name);
        $mail->Body = $html;
        $mail->prepForOutbound();
        $success = true;
        $emails = $bean->get_email_recipients();
        foreach ($emails as $email_address) {
            $mail->ClearAddresses();
            $mail->AddAddress($email_address);
            $success = $mail->Send() && $success;
        }
        $bean->last_run = $timedate->getNow()->asDb(false);
        $bean->save();
        return true;
    }
开发者ID:omusico,项目名称:erp,代码行数:68,代码来源:scheduledtasks.ext.php


示例8: _Send_Email

 function _Send_Email($fromAddress, $fromName, $toAddresses, $subject, $module, $bean_id, $body, $attachedFiles = array(), $saveCopy = true)
 {
     global $current_user, $sugar_config;
     if ($sugar_config['dbconfig']['db_host_name'] != '10.2.1.20' && $sugar_config['dbconfig']['db_host_name'] != '127.0.0.1') {
         $send_ok = false;
     } else {
         $send_ok = true;
     }
     //Replace general variables for all email templates.
     $keys = array('$contact_name', '$contact_first_name', '$sales_full_name', '$sales_first_name');
     $vars_count = $this->substr_count_array($body, $keys);
     if (($module == 'Contacts' || $module == 'Leads') && $vars_count > 0) {
         $clientObj = BeanFactory::getBean($module, $bean_id);
         $sale_person = $this->_getSalesPerson($clientObj);
         $data = array($clientObj->first_name . ' ' . $clientObj->last_name, $clientObj->first_name, $sale_person['sales_full_name'], $sale_person['sales_first_name']);
         $body = str_replace($keys, $data, $body);
     }
     //if(!$send_ok) $GLOBALS['log']->error('Mail Service: not a Live Server, trashmail accounts service only. ');
     $emailObj = new Email();
     $defaults = $emailObj->getSystemDefaultEmail();
     $mail = new SugarPHPMailer();
     $mail->setMailerForSystem();
     $mail->From = $fromAddress;
     $mail->FromName = $fromName;
     $mail->Subject = $subject;
     $mail->Body = $body;
     $mail->ContentType = "text/html";
     $mail->prepForOutbound();
     $test_addr = false;
     foreach ($toAddresses as $name => $email) {
         $mail->AddAddress($email, $name);
         if (substr_count($email, '@trashmail') > 0 || $email == '[email protected]') {
             $test_addr = true;
         }
     }
     if ($send_ok || $test_addr) {
         if (!empty($attachedFiles)) {
             foreach ($attachedFiles as $files) {
                 $mail->AddAttachment($files['file_location'] . $files['filename'], $files['filename'], 'base64');
             }
         }
         if (@$mail->Send()) {
             if ($saveCopy) {
                 $emailObj->from_addr = $fromAddress;
                 $emailObj->reply_to_addr = implode(',', $toAddresses);
                 $emailObj->to_addrs = implode(',', $toAddresses);
                 $emailObj->name = $subject;
                 $emailObj->type = 'out';
                 $emailObj->status = 'sent';
                 $emailObj->intent = 'pick';
                 $emailObj->parent_type = $module;
                 $emailObj->parent_id = $bean_id;
                 $emailObj->description_html = $body;
                 $emailObj->description = $body;
                 $emailObj->assigned_user_id = $current_user->id;
                 $emailObj->save();
                 if (!empty($attachedFiles)) {
                     foreach ($attachedFiles as $files) {
                         $Notes = BeanFactory::getBean('Notes');
                         $Notes->name = $files['filename'];
                         $Notes->file_mime_type = 'pdf';
                         $Notes->filename = $files['filename'];
                         $Notes->parent_type = 'Emails';
                         $Notes->parent_id = $emailObj->id;
                         $Notes->save();
                         $pdf = file_get_contents($files['file_location'] . $files['filename']);
                         file_put_contents('upload/' . $Notes->id, $pdf);
                     }
                 }
             }
             return true;
         } else {
             $GLOBALS['log']->info("Mailer error: " . $mail->ErrorInfo);
             return false;
         }
     } else {
         $GLOBALS['log']->error('Mail Service: not a Live Server(' . $sugar_config['dbconfig']['db_host_name'] . '), trashmail accounts service only. Cannot send mail to ' . print_r($toAddresses, true));
         $emailObj->from_addr = $fromAddress;
         $emailObj->reply_to_addr = implode(',', $toAddresses);
         $emailObj->to_addrs = implode(',', $toAddresses);
         $emailObj->name = 'TEST MODE, NOT SENT: ' . $subject;
         $emailObj->type = 'out';
         $emailObj->status = 'NOT sent';
         $emailObj->intent = 'pick';
         $emailObj->parent_type = $module;
         $emailObj->parent_id = $bean_id;
         $emailObj->description_html = $body;
         $emailObj->description = $body;
         $emailObj->assigned_user_id = $current_user->id;
         $emailObj->save();
         return false;
     }
 }
开发者ID:dsmikhal,项目名称:SugarCRM-Integrations,代码行数:93,代码来源:Global_Functions.php


示例9: Email

    if ($prevemail != "[email protected]") {
        $idx++;
        $emailbody[$idx]['email'] = "[email protected]";
        $emailbody[$idx]['subject'] = "CS All Unassigned Case Report";
        $emailbody[$idx]['body'] .= "The following cases are unassigned :<br /><br />";
        $emailbody[$idx]['body'] .= "<a href='" . $row['link'] . "'>" . $row['case_number'] . " - " . $row['name'] . "</a><br />";
        $prevemail = "[email protected]";
    } else {
        $emailbody[$idx]['body'] .= "<a href='" . $row['link'] . "'>" . $row['case_number'] . " - " . $row['name'] . "</a><br />";
        $prevemail = "[email protected]";
    }
}
/* Send out emails */
$emailObj = new Email();
$defaults = $emailObj->getSystemDefaultEmail();
$mail = new SugarPHPMailer();
$mail->setMailerForSystem();
$mail->From = $defaults['email'];
$mail->FromName = $defaults['name'];
foreach ($emailbody as $data) {
    $mail->ClearAllRecipients();
    $mail->ClearReplyTos();
    $mail->Subject = $data['subject'];
    $mail->IsHTML(true);
    $mail->Body = $data['body'];
    $mail->AltBody = $data['body'];
    $mail->prepForOutbound();
    $mail->AddAddress($data['email']);
    $mail->Send();
}
/* Clean up shop */
开发者ID:aldridged,项目名称:gtg-sugar,代码行数:31,代码来源:casegroupcs.php


示例10: in

/* Query database to get case aging */
$query = 'select c.case_number,c.name,concat("http://dcmaster.mydatacom.com/index.php?module=Cases&action=DetailView&record=",c.id) as link from cases as c where c.id not in (select distinct case_id from projects_cases) and c.account_id is null and c.status="New" and c.deleted=0;';
$db = DBManagerFactory::getInstance();
$result = $db->query($query, true, 'Case Unassigned Query Failed');
/* Create email bodies to send */
$linecount = 0;
$emailbody = "The following cases are currently unassigned:<br /><br />";
while (($row = $db->fetchByAssoc($result)) != null) {
    $emailbody .= "<a href='" . $row['link'] . "'>" . $row['case_number'] . " - " . $row['name'] . " </a><br />";
    $linecount++;
}
if ($linecount > 0) {
    /* Send out emails */
    $emailObj = new Email();
    $defaults = $emailObj->getSystemDefaultEmail();
    $mail = new SugarPHPMailer();
    $mail->setMailerForSystem();
    $mail->From = $defaults['email'];
    $mail->FromName = $defaults['name'];
    $mail->ClearAllRecipients();
    $mail->ClearReplyTos();
    $mail->Subject = "Unassigned Case Report";
    $mail->IsHTML(true);
    $mail->Body = $emailbody;
    $mail->AltBody = $emailbody;
    $mail->prepForOutbound();
    $mail->AddAddress('[email protected]');
    $mail->Send();
    /* Clean up shop */
    $mail->SMTPClose();
}
开发者ID:aldridged,项目名称:gtg-sugar,代码行数:31,代码来源:caseunassigned.php


示例11: send

 /**
  * Sends Email
  * @return bool True on success
  */
 function send()
 {
     global $mod_strings, $app_strings;
     global $current_user;
     global $sugar_config;
     global $locale;
     $OBCharset = $locale->getPrecedentPreference('default_email_charset');
     $mail = new SugarPHPMailer();
     foreach ($this->to_addrs_arr as $addr_arr) {
         if (empty($addr_arr['display'])) {
             $mail->AddAddress($addr_arr['email'], "");
         } else {
             $mail->AddAddress($addr_arr['email'], $locale->translateCharsetMIME(trim($addr_arr['display']), 'UTF-8', $OBCharset));
         }
     }
     foreach ($this->cc_addrs_arr as $addr_arr) {
         if (empty($addr_arr['display'])) {
             $mail->AddCC($addr_arr['email'], "");
         } else {
             $mail->AddCC($addr_arr['email'], $locale->translateCharsetMIME(trim($addr_arr['display']), 'UTF-8', $OBCharset));
         }
     }
     foreach ($this->bcc_addrs_arr as $addr_arr) {
         if (empty($addr_arr['display'])) {
             $mail->AddBCC($addr_arr['email'], "");
         } else {
             $mail->AddBCC($addr_arr['email'], $locale->translateCharsetMIME(trim($addr_arr['display']), 'UTF-8', $OBCharset));
         }
     }
     $mail = $this->setMailer($mail);
     // FROM ADDRESS
     if (!empty($this->from_addr)) {
         $mail->From = $this->from_addr;
     } else {
         $mail->From = $current_user->getPreference('mail_fromaddress');
         $this->from_addr = $mail->From;
     }
     // FROM NAME
     if (!empty($this->from_name)) {
         $mail->FromName = $this->from_name;
     } else {
         $mail->FromName = $current_user->getPreference('mail_fromname');
         $this->from_name = $mail->FromName;
     }
     //Reply to information for case create and autoreply.
     if (!empty($this->reply_to_name)) {
         $ReplyToName = $this->reply_to_name;
     } else {
         $ReplyToName = $mail->FromName;
     }
     if (!empty($this->reply_to_addr)) {
         $ReplyToAddr = $this->reply_to_addr;
     } else {
         $ReplyToAddr = $mail->From;
     }
     $mail->Sender = $mail->From;
     /* set Return-Path field in header to reduce spam score in emails sent via Sugar's Email module */
     $mail->AddReplyTo($ReplyToAddr, $locale->translateCharsetMIME(trim($ReplyToName), 'UTF-8', $OBCharset));
     //$mail->Subject = html_entity_decode($this->name, ENT_QUOTES, 'UTF-8');
     $mail->Subject = $this->name;
     ///////////////////////////////////////////////////////////////////////
     ////	ATTACHMENTS
     foreach ($this->saved_attachments as $note) {
         $mime_type = 'text/plain';
         if ($note->object_name == 'Note') {
             if (!empty($note->file->temp_file_location) && is_file($note->file->temp_file_location)) {
                 // brandy-new file upload/attachment
                 $file_location = $sugar_config['upload_dir'] . $note->id;
                 $filename = $note->file->original_file_name;
                 $mime_type = $note->file->mime_type;
             } else {
                 // attachment coming from template/forward
                 $file_location = rawurldecode(UploadFile::get_file_path($note->filename, $note->id));
                 // cn: bug 9723 - documents from EmailTemplates sent with Doc Name, not file name.
                 $filename = !empty($note->filename) ? $note->filename : $note->name;
                 $mime_type = $note->file_mime_type;
             }
         } elseif ($note->object_name == 'DocumentRevision') {
             // from Documents
             $filePathName = $note->id;
             // cn: bug 9723 - Emails with documents send GUID instead of Doc name
             $filename = $note->getDocumentRevisionNameForDisplay();
             $file_location = getcwd() . '/' . $GLOBALS['sugar_config']['upload_dir'] . $filePathName;
             $mime_type = $note->file_mime_type;
         }
         // strip out the "Email attachment label if exists
         $filename = str_replace($mod_strings['LBL_EMAIL_ATTACHMENT'] . ': ', '', $filename);
         //is attachment in our list of bad files extensions?  If so, append .txt to file location
         //get position of last "." in file name
         $file_ext_beg = strrpos($file_location, ".");
         $file_ext = "";
         //get file extension
         if ($file_ext_beg > 0) {
             $file_ext = substr($file_location, $file_ext_beg + 1);
         }
         //check to see if this is a file with extension located in "badext"
//.........这里部分代码省略.........
开发者ID:rgauss,项目名称:sugarcrm_dev,代码行数:101,代码来源:Email.php


示例12: sendReminders

 /**
  * send reminders
  * @param SugarBean $bean
  * @param Administration $admin
  * @param array $recipients
  * @return boolean
  */
 protected function sendReminders(SugarBean $bean, Administration $admin, $recipients)
 {
     if (empty($_SESSION['authenticated_user_language'])) {
         $current_language = $GLOBALS['sugar_config']['default_language'];
     } else {
         $current_language = $_SESSION['authenticated_user_language'];
     }
     if (!empty($bean->created_by)) {
         $user_id = $bean->created_by;
     } else {
         if (!empty($bean->assigned_user_id)) {
             $user_id = $bean->assigned_user_id;
         } else {
             $user_id = $GLOBALS['current_user']->id;
         }
     }
     $user = new User();
     $user->retrieve($bean->created_by);
     $OBCharset = $GLOBALS['locale']->getPrecedentPreference('default_email_charset');
     $mail = new SugarPHPMailer();
     $mail->setMailerForSystem();
     if (empty($admin->settings['notify_send_from_assigning_user'])) {
         $from_address = $admin->settings['notify_fromaddress'];
         $from_name = $admin->settings['notify_fromname'] ? "" : $admin->settings['notify_fromname'];
     } else {
         $from_address = $user->emailAddress->getReplyToAddress($user);
         $from_name = $user->full_name;
     }
     $mail->From = $from_address;
     $mail->FromName = $from_name;
     $xtpl = new XTemplate(get_notify_template_file($current_language));
     $xtpl = $this->setReminderBody($xtpl, $bean, $user);
     $template_name = $GLOBALS['beanList'][$bean->module_dir] . 'Reminder';
     $xtpl->parse($template_name);
     $xtpl->parse($template_name . "_Subject");
     $mail->Body = from_html(trim($xtpl->text($template_name)));
     $mail->Subject = from_html($xtpl->text($template_name . "_Subject"));
     $oe = new OutboundEmail();
     $oe = $oe->getSystemMailerSettings();
     if (empty($oe->mail_smtpserver)) {
         Log::fatal("Email Reminder: error sending email, system smtp server is not set");
         return;
     }
     foreach ($recipients as $r) {
         $mail->ClearAddresses();
         $mail->AddAddress($r['email'], $GLOBALS['locale']->translateCharsetMIME(trim($r['name']), 'UTF-8', $OBCharset));
         $mail->prepForOutbound();
         if (!$mail->Send()) {
             Log::fatal("Email Reminder: error sending e-mail (method: {$mail->Mailer}), (error: {$mail->ErrorInfo})");
         }
     }
     return true;
 }
开发者ID:butschster,项目名称:sugarcrm_dev,代码行数:60,代码来源:EmailReminder.php


示例13: sendEmailPassword

 /**
  * Sends the users password to the email address or sends 
  *
  * @param unknown_type $user_id
  * @param unknown_type $password
  */
 function sendEmailPassword($user_id, $password)
 {
     $result = $GLOBALS['db']->query("SELECT email1, email2, first_name, last_name FROM users WHERE id='{$user_id}'");
     $row = $GLOBALS['db']->fetchByAssoc($result);
     global $sugar_config;
     if (empty($row['email1']) && empty($row['email2'])) {
         $_SESSION['login_error'] = 'Please contact an administrator to setup up your email address associated to this account';
         return;
     }
     require_once "include/SugarPHPMailer.php";
     $notify_mail = new SugarPHPMailer();
     $notify_mail->CharSet = $sugar_config['default_charset'];
     $notify_mail->AddAddress(!empty($row['email1']) ? $row['email1'] : $row['email2'], $row['first_name'] . ' ' . $row['last_name']);
     if (empty($_SESSION['authenticated_user_language'])) {
         $current_language = $sugar_config['default_language'];
     } else {
         $current_language = $_SESSION['authenticated_user_language'];
     }
     $mail_settings = new Administration();
     $mail_settings->retrieveSettings('mail');
     $notify_mail->Subject = 'Sugar Token';
     $notify_mail->Body = 'Your sugar session authentication token  is: ' . $password;
     if ($mail_settings->settings['mail_sendtype'] == "SMTP") {
         $notify_mail->Mailer = "smtp";
         $notify_mail->Host = $mail_settings->settings['mail_smtpserver'];
         $notify_mail->Port = $mail_settings->settings['mail_smtpport'];
         if ($mail_settings->settings['mail_smtpauth_req']) {
             $notify_mail->SMTPAuth = TRUE;
             $notify_mail->Username = $mail_settings->settings['mail_smtpuser'];
             $notify_mail->Password = $mail_settings->settings['mail_smtppass'];
         }
     }
     $notify_mail->From = '[email protected]';
     $notify_mail->FromName = 'Sugar Authentication';
     if (!$notify_mail->Send()) {
         $GLOBALS['log']->warn("Notifications: error sending e-mail (method: {$notify_mail->Mailer}), (error: {$notify_mail->ErrorInfo})");
     } else {
         $GLOBALS['log']->info("Notifications: e-mail successfully sent");
     }
 }
开发者ID:BackupTheBerlios,项目名称:livealphaprint,代码行数:46,代码来源:EmailAuthenticateUser.php


示例14: send

 function send()
 {
     global $mod_strings;
     global $current_user;
     global $sugar_config;
     global $locale;
     $mail = new SugarPHPMailer();
     foreach ($this->to_addrs_arr as $addr_arr) {
         if (empty($addr_arr['display'])) {
             $mail->AddAddress($addr_arr['email'], "");
         } else {
             $mail->AddAddress($addr_arr['email'], $addr_arr['display']);
         }
     }
     foreach ($this->cc_addrs_arr as $addr_arr) {
         if (empty($addr_arr['display'])) {
             $mail->AddCC($addr_arr['email'], "");
         } else {
             $mail->AddCC($addr_arr['email'], $addr_arr['display']);
         }
     }
     foreach ($this->bcc_addrs_arr as $addr_arr) {
         if (empty($addr_arr['display'])) {
             $mail->AddBCC($addr_arr['email'], "");
         } else {
             $mail->AddBCC($addr_arr['email'], $addr_arr['display']);
         }
     }
     if ($current_user->getPreference('mail_sendtype') == "SMTP") {
         $mail->Mailer = "smtp";
         $mail->Host = $current_user->getPreference('mail_smtpserver');
         $mail->Port = $current_user->getPreference('mail_smtpport');
         if ($current_user->getPreference('mail_smtpauth_req')) {
             $mail->SMTPAuth = TRUE;
             $mail->Username = $current_user->getPreference('mail_smtpuser');
             $mail->Password = $current_user->getPreference('mail_smtppass');
         }
     } else {
         // cn:no need to check since we default to it in any case!
         $mail->Mailer = "sendmail";
     }
     // FROM ADDRESS
     if (!empty($this->from_addr)) {
         $mail->From = $this->from_addr;
     } else {
         $mail->From = $current_user->getPreference('mail_fromaddress');
         $this->from_addr = $mail->From;
     }
     // FROM NAME
     if (!empty($this->from_name)) {
         $mail->FromName = $this->from_name;
     } else {
         $mail->FromName = $current_user->getPreference('mail_fromname');
         $this->from_name = $mail->FromName;
     }
     $mail->Sender = $mail->From;
     /* set Return-Path field in header to reduce spam score in emails sent via Sugar's Email module */
     $mail->AddReplyTo($mail->From, $mail->FromName);
     $encoding = version_compare(phpversion(), '5.0', '>=') ? 'UTF-8' : 'ISO-8859-1';
     $mail->Subject = html_entity_decode($this->name, ENT_QUOTES, $encoding);
     ///////////////////////////////////////////////////////////////////////
     ////	ATTACHMENTS
     foreach ($this->saved_attachments as $note) {
         $mime_type = 'text/plain';
         if ($note->object_name == 'Note') {
             if (!empty($note->file->temp_file_location) && is_file($note->file->temp_file_location)) {
                 // brandy-new file upload/attachment
                 $file_location = $sugar_config['upload_dir'] . $note->id;
                 $filename = $note->file->original_file_name;
                 $mime_type = $note->file->mime_type;
             } else {
                 // attachment coming from template/forward
                 $file_location = rawurldecode(UploadFile::get_file_path($note->filename, $note->id));
                 $filename = $note->name;
                 $mime_type = $note->file_mime_type;
             }
         } elseif ($note->object_name == 'DocumentRevision') {
             // from Documents
             $filename = $note->id;
             $file_location = getcwd() . '/cache/upload/' . $filename;
             $mime_type = $note->file_mime_type;
         }
         // strip out the "Email attachment label if exists
         $filename = str_replace($mod_strings['LBL_EMAIL_ATTACHMENT'] . ': ', '', $filename);
         // cn: bug 9233 attachment filenames need to be translated into the destination charset.
         $filename = $locale->translateCharset($filename, 'UTF-8', $locale->getPrecedentPreference('default_email_charset'));
         //is attachment in our list of bad files extensions?  If so, append .txt to file location
         //get position of last "." in file name
         $file_ext_beg = strrpos($file_location, ".");
         $file_ext = "";
         //get file extension
         if ($file_ext_beg > 0) {
             $file_ext = substr($file_location, $file_ext_beg + 1);
         }
         //check to see if this is a file with extension located in "badext"
         foreach ($sugar_config['upload_badext'] as $badExt) {
             if (strtolower($file_ext) == strtolower($badExt)) {
                 //if found, then append with .txt to filename and break out of lookup
                 //this will make sure that the file goes out with right extension, but is stored
                 //as a text in db.
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:livealphaprint,代码行数:101,代码来源:Email.php


示例15: SugarPHPMailer

    $sugar_smarty->assign("LDAP_ENC_KEY_DESC", $config_strings['LBL_LDAP_ENC_KEY_DESC']);
}
$sugar_smarty->assign("settings", $focus->settings);
if ($valid_public_key) {
    if (!empty($focus->settings['captcha_on'])) {
        $sugar_smarty->assign("CAPTCHA_CONFIG_DISPLAY", 'inline');
    } else {
        $sugar_smarty->assign("CAPTCHA_CONFIG_DISPLAY", 'none');
    }
} else {
    $sugar_smarty->assign("CAPTCHA_CONFIG_DISPLAY", 'inline');
}
$sugar_smarty->assign("VALID_PUBLIC_KEY", $valid_public_key);
$res = $GLOBALS['sugar_config']['passwordsetting'];
require_once 'include/SugarPHPMailer.php';
$mail = new SugarPHPMailer();
$mail->setMailerForSystem();
if ($mail->Mailer == 'smtp' && $mail->Host == '') {
    $sugar_smarty->assign("SMTP_SERVER_NOT_SET", '1');
} else {
    $sugar_smarty->assign("SMTP_SERVER_NOT_SET", '0');
}
$focus = new InboundEmail();
$focus->checkImap();
$storedOptions = unserialize(base64_decode($focus->stored_options));
$email_templates_arr = get_bean_select_array(true, 'EmailTemplate', 'name', '', 'name', true);
$create_case_email_template = isset($storedOptions['create_case_email_template']) ? $storedOptions['create_case_email_template'] : "";
$TMPL_DRPDWN_LOST = get_select_options_with_id($email_templates_arr, $res['lostpasswordtmpl']);
$TMPL_DRPDWN_GENERATE = get_select_options_with_id($email_templates_arr, $res['generatepasswordtmpl']);
$sugar_smarty->assign("TMPL_DRPDWN_LOST", $TMPL_DRPDWN_LOST);
$sugar_smarty->assign("TMPL_DRPDWN_GENERATE", $TMPL_DRPDWN_GENERATE);
开发者ID:NALSS,项目名称:SuiteCRM,代码行数:31,代码来源:PasswordManager.php


示例16: timestampdiff

require_once 'include/entryPoint.php';
require_once 'include/database/DBManagerFactory.php';
require_once 'include/SugarPHPMailer.php';
require_once 'modules/Emails/Email.php';
/* Query database to get case aging */
$query = 'select ca.date_created,c.case_number,c.name,concat("http://dcmaster.mydatacom.com/index.php?module=Cases&action=DetailView&record=",c.id) as link from cases_audit as ca, cases as c where ca.field_name="status" and ca.after_value_string="closed" and c.deleted=0 and timestampdiff(hour,date_created,now())<=24 and c.id=ca.parent_id;';
$db = DBManagerFactory::getInstance();
$result = $db->query($query, true, 'Case Closed Query Failed');
/* Create email bodies to send */
$emailbody = "The following cases were closed in the last 24 hours:<br /><br />";
while (($row = $db->fetchByAssoc($result)) != null) {
    $emailbody .= "<a href='" . $row['link'] . "'>" . $row['case_number'] . " - " . $row['name'] . " - " . $row['date_created'] . " </a><br />";
}
/* Send out emails */
$emailObj = new Email();
$defaults = $emailObj->getSystemDefaultEmail();
$mail = new SugarPHPMailer();
$mail->setMailerForSystem();
$mail->From = $defaults['email'];
$mail->FromName = $defaults['name'];
$mail->ClearAllRecipients();
$mail->ClearReplyTos();
$mail->Subject = "Case Closed Report";
$mail->IsHTML(true);
$mail->Body = $emailbody;
$mail->AltBody = $emailbody;
$mail->prepForOutbound();
$mail->AddAddress('[email protected]');
$mail->Send();
/* Clean up shop */
$mail->SMTPClose();
开发者ID:aldridged,项目名称:gtg-sugar,代码行数:31,代码来源:caseclosed.php


示例17: displayReport


//.........这里部分代码省略.........
            if ($returnHtml) {
                return $executedWebServiceReportHtml;
            } else {
                echo $executedWebServiceReportHtml;
            }
        } else {
            $exportHttpFile = fopen($tmpFilesDir . $httpHtmlFile, "w");
            fwrite($exportHttpFile, $executedWebServiceReportHtml);
            fclose($exportHttpFile);
            if ($returnHtml) {
                return false;
            }
        }
    } else {
        if ($reportType === 'stored' && $_REQUEST['entryPoint'] != 'viewReport') {
            // Stored Report!
            //****************************************//
            //*********Get Stored Report Data*********//
            //****************************************//
            $reportType = explode(':', $focus->report_type);
            echo asol_ReportsGenerationFunctions::getStoredReportData($reportType[1], $reportId, $isDashlet, $dashletId, $focus->report_charts);
        } else {
            // Anything else Report!
            if ($entryPointExecuted || $executeReportDirectly) {
                //*********************************//
                //****Check Access To Reports******//
                //*********************************//
                if (!ACLController::checkAccess('asol_Reports', 'view', true) && !$hasVardefFilter) {
                    die("<font color='red'>" . $app_strings["LBL_EMAIL_DELETE_ERROR_DESC"] . "</font>");
                }
                //*************************************************//
                //******Requiring FilesGet External Parameters*****//
                //*************************************************//
                require_once "include/SugarPHPMailer.php";
                require_once 'modules/asol_Reports/include_basic/ReportExcel.php';
                require_once 'modules/asol_Reports/include_basic/ReportFile.php';
                require_once 'modules/asol_Reports/include_basic/ReportChart.php';
                require_once 'modules/asol_Reports/include_basic/manageReportsFunctions.php';
                require_once 'modules/asol_Reports/include_basic/generateQuery.php';
                //*****************************//
                //****Variable Definition******//
                //*****************************//
 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP SugarTestContactUtilities类代码示例发布时间:2022-05-23
下一篇:
PHP SugarModule类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap