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


PHP OutboundEmail类代码示例

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


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

示例1: testGetAssoicatedInboundAccountForOutboundAccounts

 function testGetAssoicatedInboundAccountForOutboundAccounts()
 {
     global $current_user;
     $ob = new OutboundEmail();
     $ob->id = $this->outbound_id;
     $results = $ob->getAssociatedInboundAccounts($current_user);
     $this->assertEquals($this->ib->id, $results[0], "Could not retrieve the inbound mail accounts for an outbound account");
     $obEmpty = new OutboundEmail();
     $obEmpty->id = uniqid();
     $empty_results = $obEmpty->getAssociatedInboundAccounts($current_user);
     $this->assertEquals(0, count($empty_results), "Outbound email account returned for unspecified/empty inbound mail account.");
 }
开发者ID:delkyd,项目名称:sugarcrm_dev,代码行数:12,代码来源:Bug32487Test.php

示例2: SugarPHPMailer

 /**
  * Sole constructor
  */
 function SugarPHPMailer()
 {
     global $locale;
     global $current_user;
     global $sugar_config;
     $admin = new Administration();
     $admin->retrieveSettings();
     if (isset($admin->settings['disclosure_enable']) && !empty($admin->settings['disclosure_enable'])) {
         $this->disclosureEnabled = true;
         $this->disclosureText = $admin->settings['disclosure_text'];
     }
     $this->oe = new OutboundEmail();
     $this->oe->getUserMailerSettings($current_user);
     $this->SetLanguage('en', 'vendor/phpmailer/phpmailer/language/');
     $this->PluginDir = 'custom/include/phpmailer/';
     $this->Mailer = 'smtp';
     // cn: i18n
     $this->CharSet = $locale->getPrecedentPreference('default_email_charset');
     $this->Encoding = 'quoted-printable';
     $this->IsHTML(false);
     // default to plain-text email
     $this->Hostname = $sugar_config['host_name'];
     $this->WordWrap = 996;
     // cn: gmail fix
     $this->protocol = $this->oe->mail_smtpssl == 1 ? "ssl://" : $this->protocol;
 }
开发者ID:butschster,项目名称:sugarcrm_dev,代码行数:29,代码来源:SugarPHPMailer.php

示例3: testFieldsEncoding

 /**
  * @dataProvider getFields
  * @param string $field
  */
 public function testFieldsEncoding($field)
 {
     // testing insert
     $ob = new OutboundEmail();
     $ob->type = 'test';
     $ob->id = create_guid();
     $ob->new_with_id = true;
     $ob->name = 'Test ' . $ob->id;
     $ob->user_id = '1';
     $ob->{$field} = mt_rand() . " test \\ 'test' " . mt_rand();
     $ob->save();
     // testing update
     $ob->new_with_id = false;
     $ob->name = 'Update ' . $ob->id;
     $ob->user_id = '1';
     $ob->{$field} = mt_rand() . " test2 \\ 'test2' " . mt_rand();
     $ob->save();
 }
开发者ID:thsonvt,项目名称:sugarcrm_dev,代码行数:22,代码来源:Bug59310Test.php

示例4: doesUserOverrideAccountRequireCredentials

 /**
  * Determines if a user needs to set their user name/password for their system
  * override account.
  *
  * @param unknown_type $user_id
  * @return unknown
  */
 function doesUserOverrideAccountRequireCredentials($user_id)
 {
     $userCredentialsReq = FALSE;
     $sys = new OutboundEmail();
     $ob = $sys->getSystemMailerSettings();
     //Dirties '$this'
     //If auth for system account is disabled or user can use system outbound account return false.
     if ($ob->mail_smtpauth_req == 0 || $this->isAllowUserAccessToSystemDefaultOutbound() || $this->mail_sendtype == 'sendmail') {
         return $userCredentialsReq;
     }
     $userOverideAccount = $this->getUsersMailerForSystemOverride($user_id);
     if ($userOverideAccount == null || empty($userOverideAccount->mail_smtpuser) || empty($userOverideAccount->mail_smtppass)) {
         $userCredentialsReq = TRUE;
     }
     return $userCredentialsReq;
 }
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:23,代码来源:OutboundEmail.php

示例5: action_Save

 function action_Save()
 {
     require_once 'include/OutboundEmail/OutboundEmail.php';
     require_once 'modules/Configurator/Configurator.php';
     $configurator = new Configurator();
     global $sugar_config;
     global $current_user;
     if (!is_admin($current_user) && !is_admin_for_module($GLOBALS['current_user'], 'Emails') && !is_admin_for_module($GLOBALS['current_user'], 'Campaigns')) {
         sugar_die("Unauthorized access to administration.");
     }
     //Do not allow users to spoof for sendmail if the config flag is not set.
     if (!isset($sugar_config['allow_sendmail_outbound']) || !$sugar_config['allow_sendmail_outbound']) {
         $_REQUEST['mail_sendtype'] = "SMTP";
     }
     // save Outbound settings  #Bug 20033 Ensure data for Outbound email exists before trying to update the system mailer.
     if (isset($_REQUEST['mail_sendtype']) && empty($_REQUEST['campaignConfig'])) {
         $oe = new OutboundEmail();
         $oe->populateFromPost();
         $oe->saveSystem();
     }
     $focus = new Administration();
     if (isset($_POST['tracking_entities_location_type'])) {
         if ($_POST['tracking_entities_location_type'] != '2') {
             unset($_POST['tracking_entities_location']);
             unset($_POST['tracking_entities_location_type']);
         }
     }
     // cn: handle mail_smtpauth_req checkbox on/off (removing double reference in the form itself
     if (!isset($_POST['mail_smtpauth_req'])) {
         $_POST['mail_smtpauth_req'] = 0;
         if (empty($_POST['campaignConfig'])) {
             $_POST['notify_allow_default_outbound'] = 0;
             // If smtp auth is disabled ensure outbound is disabled.
         }
     }
     if (!empty($_POST['notify_allow_default_outbound'])) {
         $oe = new OutboundEmail();
         if (!$oe->isAllowUserAccessToSystemDefaultOutbound()) {
             $oe->removeUserOverrideAccounts();
         }
     }
     $focus->saveConfig();
     // save User defaults for emails
     $configurator->config['email_default_delete_attachments'] = isset($_REQUEST['email_default_delete_attachments']) ? true : false;
     ///////////////////////////////////////////////////////////////////////////////
     ////	SECURITY
     $security = array();
     if (isset($_REQUEST['applet'])) {
         $security['applet'] = 'applet';
     }
     if (isset($_REQUEST['base'])) {
         $security['base'] = 'base';
     }
     if (isset($_REQUEST['embed'])) {
         $security['embed'] = 'embed';
     }
     if (isset($_REQUEST['form'])) {
         $security['form'] = 'form';
     }
     if (isset($_REQUEST['frame'])) {
         $security['frame'] = 'frame';
     }
     if (isset($_REQUEST['frameset'])) {
         $security['frameset'] = 'frameset';
     }
     if (isset($_REQUEST['iframe'])) {
         $security['iframe'] = 'iframe';
     }
     if (isset($_REQUEST['import'])) {
         $security['import'] = '\\?import';
     }
     if (isset($_REQUEST['layer'])) {
         $security['layer'] = 'layer';
     }
     if (isset($_REQUEST['link'])) {
         $security['link'] = 'link';
     }
     if (isset($_REQUEST['object'])) {
         $security['object'] = 'object';
     }
     if (isset($_REQUEST['style'])) {
         $security['style'] = 'style';
     }
     if (isset($_REQUEST['xmp'])) {
         $security['xmp'] = 'xmp';
     }
     $security['script'] = 'script';
     $configurator->config['email_xss'] = base64_encode(serialize($security));
     ////	SECURITY
     ///////////////////////////////////////////////////////////////////////////////
     ksort($sugar_config);
     $configurator->handleOverride();
 }
开发者ID:rgauss,项目名称:sugarcrm_dev,代码行数:93,代码来源:controller.php

示例6: testIsUserAuthRequiredForOverrideAccount

 function testIsUserAuthRequiredForOverrideAccount()
 {
     $oe = new OutboundEmail();
     $GLOBALS['db']->query("DELETE FROM config WHERE category='notify' AND name='allow_default_outbound' ");
     $system = $oe->getSystemMailerSettings();
     //System does not require auth, no user overide account.
     $system->mail_smtpauth_req = 0;
     $system->save(FALSE);
     $notRequired = $oe->doesUserOverrideAccountRequireCredentials($this->_user->id);
     $this->assertFalse($notRequired, "Test failed for determining if user auth required.");
     //System does require auth, no user overide account.
     $system->mail_smtpauth_req = 1;
     $system->save(FALSE);
     $notRequired = $oe->doesUserOverrideAccountRequireCredentials($this->_user->id);
     $this->assertTrue($notRequired, "Test failed for determining if user auth required.");
     //System requires auth and users alloweed to use sys defaults.
     $GLOBALS['db']->query("INSERT INTO config (category,name,value) VALUES ('notify','allow_default_outbound','2') ");
     $notRequired = $oe->doesUserOverrideAccountRequireCredentials($this->_user->id);
     $this->assertFalse($notRequired, "Test failed for determining if user auth required.");
     //System requires auth but user details are empty and users are not alloweed to use system details..
     $GLOBALS['db']->query("DELETE FROM config WHERE category='notify' AND name='allow_default_outbound' ");
     $userOverideAccont = $oe->createUserSystemOverrideAccount($this->_user->id, "", "");
     $this->userOverideAccont = $userOverideAccont;
     $notRequired = $oe->doesUserOverrideAccountRequireCredentials($this->_user->id);
     $this->assertTrue($notRequired, "Test failed for determining if user auth required.");
     //User has provided all credentials.
     $this->userOverideAccont->mail_smtpuser = "TEST USER NAME";
     $this->userOverideAccont->mail_smtppass = "TEST PASSWORD";
     $this->userOverideAccont->new_with_id = FALSE;
     $this->userOverideAccont->save();
     $notRequired = $oe->doesUserOverrideAccountRequireCredentials($this->_user->id);
     $this->assertFalse($notRequired, "Test failed for determining if user auth required.");
 }
开发者ID:netconstructor,项目名称:sugarcrm_dev,代码行数:33,代码来源:Bug23140Test.php

示例7: action_Save

 function action_Save()
 {
     require_once 'include/OutboundEmail/OutboundEmail.php';
     require_once 'modules/Configurator/Configurator.php';
     $configurator = new Configurator();
     global $sugar_config;
     global $current_user, $mod_strings;
     if (!is_admin($current_user) && !is_admin_for_module($GLOBALS['current_user'], 'Emails') && !is_admin_for_module($GLOBALS['current_user'], 'Campaigns')) {
         sugar_die($mod_strings['LBL_UNAUTH_ACCESS']);
     }
     //Do not allow users to spoof for sendmail if the config flag is not set.
     if (!isset($sugar_config['allow_sendmail_outbound']) || !$sugar_config['allow_sendmail_outbound']) {
         $_REQUEST['mail_sendtype'] = "SMTP";
     }
     // save Outbound settings  #Bug 20033 Ensure data for Outbound email exists before trying to update the system mailer.
     if (isset($_REQUEST['mail_sendtype']) && empty($_REQUEST['campaignConfig'])) {
         $oe = new OutboundEmail();
         $oe->populateFromPost();
         $oe->saveSystem();
     }
     $focus = BeanFactory::getBean('Administration');
     if (isset($_POST['tracking_entities_location_type'])) {
         if ($_POST['tracking_entities_location_type'] != '2') {
             unset($_POST['tracking_entities_location']);
             unset($_POST['tracking_entities_location_type']);
         }
     }
     // cn: handle mail_smtpauth_req checkbox on/off (removing double reference in the form itself
     if (!isset($_POST['mail_smtpauth_req'])) {
         $_POST['mail_smtpauth_req'] = 0;
         if (empty($_POST['campaignConfig'])) {
             $_POST['notify_allow_default_outbound'] = 0;
             // If smtp auth is disabled ensure outbound is disabled.
         }
     }
     $focus->saveConfig();
     // mark user metadata changed so the user preferences get refreshed
     // (user preferences contain email client preference)
     $mm = MetadataManager::getManager();
     $mm->setUserMetadataHasChanged($current_user);
     // save User defaults for emails
     $configurator->config['email_default_delete_attachments'] = isset($_REQUEST['email_default_delete_attachments']) ? true : false;
     ///////////////////////////////////////////////////////////////////////////////
     ////	SECURITY
     $security = array();
     if (isset($_REQUEST['applet'])) {
         $security['applet'] = 'applet';
     }
     if (isset($_REQUEST['base'])) {
         $security['base'] = 'base';
     }
     if (isset($_REQUEST['embed'])) {
         $security['embed'] = 'embed';
     }
     if (isset($_REQUEST['form'])) {
         $security['form'] = 'form';
     }
     if (isset($_REQUEST['frame'])) {
         $security['frame'] = 'frame';
     }
     if (isset($_REQUEST['frameset'])) {
         $security['frameset'] = 'frameset';
     }
     if (isset($_REQUEST['iframe'])) {
         $security['iframe'] = 'iframe';
     }
     if (isset($_REQUEST['import'])) {
         $security['import'] = '\\?import';
     }
     if (isset($_REQUEST['layer'])) {
         $security['layer'] = 'layer';
     }
     if (isset($_REQUEST['link'])) {
         $security['link'] = 'link';
     }
     if (isset($_REQUEST['object'])) {
         $security['object'] = 'object';
     }
     if (isset($_REQUEST['style'])) {
         $security['style'] = 'style';
     }
     if (isset($_REQUEST['xmp'])) {
         $security['xmp'] = 'xmp';
     }
     $security['script'] = 'script';
     $configurator->config['email_xss'] = base64_encode(serialize($security));
     ////	SECURITY
     ///////////////////////////////////////////////////////////////////////////////
     ksort($sugar_config);
     $configurator->handleOverride();
 }
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:91,代码来源:controller.php

示例8: OutboundEmail

 * In accordance with Section 7(b) of the GNU General Public License version 3,
 * these Appropriate Legal Notices must retain the display of the "Powered by
 * SugarCRM" logo. If the display of the logo is not reasonably feasible for
 * technical reasons, the Appropriate Legal Notices must display the words
 * "Powered by SugarCRM".
 ********************************************************************************/
/*********************************************************************************
 * Description:  TODO: To be written.
 * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
 * All Rights Reserved.
 * Contributor(s): ______________________________________..
 ********************************************************************************/
require_once 'include/OutboundEmail/OutboundEmail.php';
// save Outbound (SMTP/Sendmail) settings  #Bug 20033 Ensure data for Outbound email exists before trying to update the system mailer.
if (isset($_REQUEST['mail_sendtype'])) {
    $oe = new OutboundEmail();
    $oe->populateFromPost();
    $oe->saveSystem();
}
$focus = new Administration();
if (isset($_POST['tracking_entities_location_type'])) {
    if ($_POST['tracking_entities_location_type'] != '2') {
        unset($_POST['tracking_entities_location']);
        unset($_POST['tracking_entities_location_type']);
    }
}
// cn: handle mail_smtpauth_req checkbox on/off (removing double reference in the form itself
if (!isset($_POST['mail_smtpauth_req'])) {
    $_POST['mail_smtpauth_req'] = 0;
}
$focus->saveConfig();
开发者ID:klr2003,项目名称:sourceread,代码行数:31,代码来源:Save.php

示例9: header

         if (isset($_POST['page']) && $_POST['page'] == 'Change') {
             header("Location: index.php?action=ChangePassword&module=Users&record=" . $_POST['record'] . "&error_password=" . urlencode($focus->error_string));
             exit;
         }
     } else {
         if ($newUser) {
             $new_pwd = '3';
         } else {
             $new_pwd = '1';
         }
     }
 }
 ///////////////////////////////////////////////////////////////////////////
 ////	OUTBOUND EMAIL SAVES
 ///////////////////////////////////////////////////////////////////////////
 $sysOutboundAccunt = new OutboundEmail();
 //If a user is not alloweed to use the default system outbound account then they will be
 //saving their own username/password for the system account
 if (!$sysOutboundAccunt->isAllowUserAccessToSystemDefaultOutbound()) {
     $userOverrideOE = $sysOutboundAccunt->getUsersMailerForSystemOverride($focus->id);
     if ($userOverrideOE != null) {
         //User is alloweed to clear username and pass so no need to check for blanks.
         $userOverrideOE->mail_smtpuser = $_REQUEST['mail_smtpuser'];
         $userOverrideOE->mail_smtppass = $_REQUEST['mail_smtppass'];
         $userOverrideOE->save();
     } else {
         //If a user name and password for the mail account is set, create the users override account.
         if (!(empty($_REQUEST['mail_smtpuser']) || empty($_REQUEST['mail_smtppass']))) {
             $sysOutboundAccunt->createUserSystemOverrideAccount($focus->id, $_REQUEST['mail_smtpuser'], $_REQUEST['mail_smtppass']);
         }
     }
开发者ID:delkyd,项目名称:sugarcrm_dev,代码行数:31,代码来源:Save.php

示例10: savePersonalEmailAccount

 /**
  * Saves Personal Inbox settings for Users
  * @param string userId ID of user to assign all emails for this account
  * @param strings userName Name of account, for Sugar purposes
  * @param bool forceSave Default true.  Flag to save errored settings.
  * @return boolean true on success, false on fail
  */
 function savePersonalEmailAccount($userId = '', $userName = '', $forceSave = true)
 {
     if (!empty($userId)) {
         $groupId = $userId;
     } elseif (isset($_REQUEST['group_id']) && !empty($_REQUEST['group_id'])) {
         $groupId = $_REQUEST['group_id'];
     } else {
         return false;
     }
     $accountExists = false;
     if (isset($_REQUEST['ie_id']) && !empty($_REQUEST['ie_id'])) {
         $this->retrieve($_REQUEST['ie_id']);
         $accountExists = true;
     }
     $ie_name = $_REQUEST['ie_name'];
     $this->is_personal = 1;
     $this->name = $ie_name;
     $this->group_id = $groupId;
     $this->status = $_REQUEST['ie_status'];
     $this->server_url = $_REQUEST['server_url'];
     $this->email_user = $_REQUEST['email_user'];
     $this->email_password = $_REQUEST['email_password'];
     $this->port = $_REQUEST['port'];
     $this->protocol = $_REQUEST['protocol'];
     if ($this->protocol == "pop3") {
         $_REQUEST['mailbox'] = "INBOX";
     }
     $this->mailbox = $_REQUEST['mailbox'];
     $this->mailbox_type = 'pick';
     // forcing this
     if (isset($_REQUEST['ssl']) && $_REQUEST['ssl'] == 1) {
         $useSsl = true;
     } else {
         $useSsl = false;
     }
     $this->service = '::::::::::';
     if ($forceSave) {
         $id = $this->save();
         // saving here to prevent user from having to re-enter all the info in case of error
         $this->retrieve($id);
     }
     $this->protocol = $_REQUEST['protocol'];
     // need to set this again since we safe the "service" string to empty explode values
     $opts = $this->getSessionConnectionString($this->server_url, $this->email_user, $this->port, $this->protocol);
     if (empty($opts)) {
         $opts = $this->findOptimumSettings($useSsl);
     }
     $delimiter = $this->getSessionInboundDelimiterString($this->server_url, $this->email_user, $this->port, $this->protocol);
     if (isset($opts['serial']) && !empty($opts['serial'])) {
         $this->service = $opts['serial'];
         if (isset($_REQUEST['mark_read']) && $_REQUEST['mark_read'] == 1) {
             $this->delete_seen = 0;
         } else {
             $this->delete_seen = 1;
         }
         // handle stored_options serialization
         if (isset($_REQUEST['only_since']) && $_REQUEST['only_since'] == 1) {
             $onlySince = true;
         } else {
             $onlySince = false;
         }
         $focusUser = new User();
         $focusUser->retrieve($groupId);
         $mailerId = isset($_REQUEST['outbound_email']) ? $_REQUEST['outbound_email'] : "";
         $oe = new OutboundEmail();
         $oe->getSystemMailerSettings($focusUser, $mailerId);
         $stored_options = array();
         $stored_options['from_name'] = $_REQUEST['from_name'];
         $stored_options['from_addr'] = $_REQUEST['from_addr'];
         if (!$this->isPop3Protocol()) {
             $stored_options['trashFolder'] = isset($_REQUEST['trashFolder']) ? $_REQUEST['trashFolder'] : "";
             $stored_options['sentFolder'] = isset($_REQUEST['sentFolder']) ? $_REQUEST['sentFolder'] : "";
         }
         // if
         $stored_options['only_since'] = $onlySince;
         $stored_options['filter_domain'] = '';
         $storedOptions['folderDelimiter'] = $delimiter;
         $stored_options['outbound_email'] = isset($_REQUEST['outbound_email']) ? $_REQUEST['outbound_email'] : $oe->id;
         $this->stored_options = base64_encode(serialize($stored_options));
         $this->save();
         return true;
     } else {
         // could not find opts, no save
         $GLOBALS['log']->debug('-----> InboundEmail could not find optimums for User: ' . $ie_name);
         return false;
     }
 }
开发者ID:nerdystudmuffin,项目名称:dashlet-subpanels,代码行数:94,代码来源:InboundEmail.php

示例11: Administration

}
$focus = new Administration();
if (isset($_POST['tracking_entities_location_type'])) {
    if ($_POST['tracking_entities_location_type'] != '2') {
        unset($_POST['tracking_entities_location']);
        unset($_POST['tracking_entities_location_type']);
    }
}
// cn: handle mail_smtpauth_req checkbox on/off (removing double reference in the form itself
if (!isset($_POST['mail_smtpauth_req'])) {
    $_POST['mail_smtpauth_req'] = 0;
    $_POST['notify_allow_default_outbound'] = 0;
    //If smtp auth is disabled ensure outbound is disabled.
}
if (!empty($_POST['notify_allow_default_outbound'])) {
    $oe = new OutboundEmail();
    if (!$oe->isAllowUserAccessToSystemDefaultOutbound()) {
        $oe->removeUserOverrideAccounts();
    }
}
$focus->saveConfig();
// save User defaults for emails
$sugar_config['email_default_delete_attachments'] = isset($_REQUEST['email_default_delete_attachments']) ? true : false;
///////////////////////////////////////////////////////////////////////////////
////	SECURITY
$security = array();
if (isset($_REQUEST['applet'])) {
    $security['applet'] = 'applet';
}
if (isset($_REQUEST['base'])) {
    $security['base'] = 'base';
开发者ID:sysraj86,项目名称:carnivalcrm,代码行数:31,代码来源:Save.php

示例12: OutboundEmail

         $oe = new OutboundEmail();
         $oe->retrieve($_REQUEST['outbound_email']);
         $ret = array();
         foreach ($oe->field_defs as $def) {
             $ret[$def] = $oe->{$def};
         }
         $out = $json->encode($ret, true);
         echo $out;
     } else {
         echo "NOOP";
     }
     break;
 case "deleteOutbound":
     $GLOBALS['log']->debug("********** EMAIL 2.0 - Asynchronous - at: deleteOutbound");
     if (isset($_REQUEST['outbound_email']) && !empty($_REQUEST['outbound_email'])) {
         $oe = new OutboundEmail();
         global $current_user;
         $oe->retrieve($_REQUEST['outbound_email']);
         $oe->delete();
         $ret = array();
         $count = 0;
         $outbounds = $oe->getUserMailers($current_user);
         $out = $json->encode($outbounds, true);
         echo $out;
     } else {
         echo "NOOP";
     }
     break;
 case "saveOutbound":
     $GLOBALS['log']->debug("********** EMAIL 2.0 - Asynchronous - at: saveOutbound");
     $oe = new OutboundEmail();
开发者ID:klr2003,项目名称:sourceread,代码行数:31,代码来源:EmailUIAjax.php

示例13: sendSugarPHPMail

/**
* Created by iluxovi4 - Убирайте везде эту подпись
* Protected by SugarTalk.ru greshdrtju
=======
*/
function sendSugarPHPMail($tos, $subject, $body, $attach = "", $nameToSend = "", $assigned_user_id, $type)
{
    require_once 'include/SugarPHPMailer.php';
    require_once 'modules/Administration/Administration.php';
    global $current_user;
    $mail = new SugarPHPMailer();
    $admin = new Administration();
    $admin->retrieveSettings();
    $user = new User();
    if ($type == 'Realty') {
        $user_id = $assigned_user_id;
        $user->retrieve($user_id);
        $oe = new OutboundEmail();
        $userSettings = $oe->getUserMailerSettings($user);
        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->Body = $body."<br/> <b style='color: red;'><strong> Важно! </strong> Ответ присылайте на почту: </b>".$userSettings->mail_smtpuser;
        $mail->Body = $body;
        $mail->From = $admin->settings['notify_fromaddress'];
    } elseif ($type == 'Contacts' or $type == 'Accounts') {
        $user_id = $assigned_user_id;
        $user->retrieve($user_id);
        $oe = new OutboundEmail();
        $userSettings = $oe->getUserMailerSettings($user);
        if ($userSettings->mail_sendtype == "SMTP") {
            $mail->Host = $admin->settings['mail_smtpserver'];
            $mail->Port = $admin->settings['mail_smtpport'];
            if ($userSettings->mail_smtpauth_req) {
                $mail->SMTPAuth = TRUE;
                $mail->Username = $userSettings->mail_smtpuser;
                $mail->Password = $userSettings->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->Body = $body;
        $mail->From = $user->email1;
    }
    //$user->retrieve();
    $mail->CharSet = 'UTF-8';
    $mail->FromName = $admin->settings['notify_fromname'];
    $mail->ContentType = "text/html";
    //"text/plain"
    $mail->IsHTML(true);
    $mail->Subject = $subject;
    $mail->AddAttachment($attach, $nameToSend);
    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,代码行数:88,代码来源:send_mail.php

示例14: handleMissingSmtpServerSettingsNotifications

/**
 * If `mail_smtpserver` setting is missing on system mailer settings, a
 * notification is created and assigned to system user.
 */
function handleMissingSmtpServerSettingsNotifications()
{
    require_once 'include/OutboundEmail/OutboundEmail.php';
    $oe = new OutboundEmail();
    $settings = $oe->getSystemMailerSettings();
    if (!empty($settings->mail_smtpserver)) {
        return;
    }
    $user = \BeanFactory::getBean('Users');
    $user->getSystemUser();
    if (empty($user)) {
        return;
    }
    $app_strings = return_application_language($GLOBALS['current_language']);
    $emailSettingsUrl = sprintf('<a href="#bwc/index.php?module=EmailMan&action=config">%s</a>', $app_strings['LBL_MISSING_SMPT_SERVER_SETTINGS_NOTIFICATION_LINK_TEXT']);
    $description = str_replace('{{emailSettingsUrl}}', $emailSettingsUrl, $app_strings['TPL_MISSING_SMPT_SERVER_SETTINGS_NOTIFICATION_DESCRIPTION']);
    $notification = \BeanFactory::getBean('Notifications');
    $notification->name = $app_strings['LBL_MISSING_SMPT_SERVER_SETTINGS_NOTIFICATION_SUBJECT'];
    $notification->description = $description;
    $notification->severity = 'warning';
    $notification->assigned_user_id = $user->id;
    $notification->save();
}
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:27,代码来源:install_utils.php

示例15: saveConfig

 function saveConfig()
 {
     // outbound email settings
     $oe = new OutboundEmail();
     foreach ($_POST as $key => $val) {
         $prefix = $this->get_config_prefix($key);
         if (in_array($prefix[0], $this->config_categories)) {
             if (is_array($val)) {
                 $val = implode(",", $val);
             }
             $this->saveSetting($prefix[0], $prefix[1], $val);
         }
         if (strpos($key, "mail_") !== false) {
             if (in_array($key, $oe->field_defs)) {
                 $oe->{$key} = $val;
             }
         }
     }
     //saving outbound email from here is probably redundant, adding a check to make sure
     //smtpserver name is set.
     if (!empty($oe->mail_smtpserver)) {
         $oe->saveSystem();
     }
     $this->retrieveSettings(false, true);
 }
开发者ID:sysraj86,项目名称:carnivalcrm,代码行数:25,代码来源:Administration.php


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