本文整理匯總了PHP中InboundEmail類的典型用法代碼示例。如果您正苦於以下問題:PHP InboundEmail類的具體用法?PHP InboundEmail怎麽用?PHP InboundEmail使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了InboundEmail類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testShouldNotQuery
/**
* @param $emailName
* @dataProvider shouldNotQueryProvider
*/
public function testShouldNotQuery($emailName)
{
$db = $this->getMockForAbstractClass('DBManager');
$db->expects($this->never())->method('query');
$ie = new InboundEmail();
$ie->db = $db;
$ie->getCaseIdFromCaseNumber($emailName, $this->case);
}
示例2: testConvertToUtf8
/**
* @group bug45059
* @dataProvider intlTextProvider
* @param string $inputText - our input from the provider, base64'ed
* @param string $expected - what our goal is
*/
public function testConvertToUtf8($inputText, $expected)
{
// the email server is down, so this test doesn't work
if (!function_exists('mb_convert_encoding')) {
$this->markTestSkipped('Need multibyte encoding support');
}
$ie = new InboundEmail();
$inputText = base64_decode($inputText);
$this->assertEquals($expected, $ie->convertToUtf8($inputText), 'We should be able to convert to UTF-8');
}
示例3: setUp
public function setUp()
{
global $current_user, $currentModule;
$mod_strings = return_module_language($GLOBALS['current_language'], "Contacts");
$current_user = SugarTestUserUtilities::createAnonymousUser();
$this->outbound_id = uniqid();
$time = date('Y-m-d H:i:s');
$ib = new InboundEmail();
$ib->is_personal = 1;
$ib->name = "Test";
$ib->port = 3309;
$ib->mailbox = 'empty';
$ib->created_by = $current_user->id;
$ib->email_password = "pass";
$ib->protocol = 'IMAP';
$stored_options['outbound_email'] = $this->outbound_id;
$ib->stored_options = base64_encode(serialize($stored_options));
$ib->save();
$this->ib = $ib;
}
示例4: testSetCacheValue
/**
* @group 49543
*/
public function testSetCacheValue()
{
global $timedate;
$ie_id = '123';
$mailbox = 'trash';
$time = mt_rand();
$subj = 'test ' . $time;
$GLOBALS['db']->query(sprintf("INSERT INTO email_cache (ie_id, mbox, subject, fromaddr, toaddr, imap_uid) \n VALUES ('%s', '%s', '%s', 'from@test.com', 'to@test.com', '11')", $ie_id, $mailbox, $subj));
//deleted item from inbox which will be inserted in trash
$insert[0] = $this->createMail($subj . '_new', 'from@test.com', 'to@test.com', '12', '2012-11-11 11:11:11', '12');
//old trash item which should be updated
$insert[1] = $this->createMail($subj . '_old', 'from@test.com', 'to@test.com', '11', '2011-11-11 11:11:11', '11');
$ie = new InboundEmail();
$ie->id = $ie_id;
$ie->setCacheValue($mailbox, $insert, '', '');
$fr = $GLOBALS['db']->fetchRow($GLOBALS['db']->query("SELECT subject FROM email_cache WHERE imap_uid = '11'"));
//if old trash item was updated successfully then 'subject' has new value
$this->assertTrue($fr['subject'] == $subj . '_old');
$GLOBALS['db']->query(sprintf("DELETE FROM email_cache WHERE mbox = '%s'", $mailbox));
}
示例5: get_campaign_mailboxes
/**
* Return bounce handling mailboxes for campaign.
*
* @param unknown_type $emails
* @param unknown_type $get_box_name, Set it to false if want to get "From Name" other than the InboundEmail Name.
* @return $get_name=true, bounce handling mailboxes' name; $get_name=false, bounce handling mailboxes' from name.
*/
function get_campaign_mailboxes(&$emails, $get_name = true)
{
if (!class_exists('InboundEmail')) {
require 'modules/InboundEmail/InboundEmail.php';
}
$query = "select id,name,stored_options from inbound_email where mailbox_type='bounce' and status='Active' and deleted='0'";
$db = DBManagerFactory::getInstance();
$result = $db->query($query);
while (($row = $db->fetchByAssoc($result)) != null) {
if ($get_name) {
$return_array[$row['id']] = $row['name'];
} else {
$return_array[$row['id']] = InboundEmail::get_stored_options('from_name', $row['name'], $row['stored_options']);
}
$emails[$row['id']] = InboundEmail::get_stored_options('from_addr', 'nobody@example.com', $row['stored_options']);
}
if (empty($return_array)) {
$return_array = array('' => '');
}
return $return_array;
}
示例6: get_campaign_mailboxes
function get_campaign_mailboxes(&$emails)
{
if (!class_exists('InboundEmail')) {
require 'modules/InboundEmail/InboundEmail.php';
}
$query = "select id,name,stored_options from inbound_email where mailbox_type='bounce' and status='Active'";
if (empty($db)) {
if (!class_exists('PearDatabase')) {
}
$db =& PearDatabase::getInstance();
}
$result = $db->query($query);
while (($row = $db->fetchByAssoc($result)) != null) {
$return_array[$row['id']] = $row['name'];
$emails[$row['id']] = InboundEmail::get_stored_options('from_addr', 'nobody@example.com', $row['stored_options']);
}
if (empty($return_array)) {
$return_array = array('' => '');
}
return $return_array;
}
示例7: retrieveAllByGroupIdWithGroupAccounts
/**
* Retrieves an array of I-E beans that the user has team access to including group
*/
function retrieveAllByGroupIdWithGroupAccounts($id, $includePersonal = true)
{
global $current_user;
$beans = $includePersonal ? $this->retrieveByGroupId($id) : array();
$teamJoin = '';
$q = "SELECT DISTINCT inbound_email.id FROM inbound_email {$teamJoin} WHERE is_personal = 0 AND mailbox_type not like 'bounce' AND status = 'Active' AND inbound_email.deleted = 0 ";
$r = $this->db->query($q, true);
while ($a = $this->db->fetchByAssoc($r)) {
$found = false;
foreach ($beans as $bean) {
if ($bean->id == $a['id']) {
$found = true;
}
}
if (!$found) {
$ie = new InboundEmail();
$ie->retrieve($a['id']);
$beans[$a['id']] = $ie;
}
}
return $beans;
}
示例8: get_select_options_with_id
$showCounts = '';
if ($focus->getPreference('email_show_counts')) {
$showCounts = 'CHECKED';
}
$xtpl->assign('EMAIL_LINK_TYPE', get_select_options_with_id($app_list_strings['dom_email_link_type'], $focus->getPreference('email_link_type')));
$xtpl->assign('EMAIL_SHOW_COUNTS', $showCounts);
$xtpl->assign('EMAIL_EDITOR_OPTION', get_select_options_with_id($app_list_strings['dom_email_editor_option'], $focus->getPreference('email_editor_option')));
$xtpl->assign('EMAIL_CHARSET', get_select_options_with_id($locale->getCharsetSelect(), $locale->getPrecedentPreference('default_email_charset', $focus)));
///// END EMAIL OPTIONS
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
//// INBOUND EMAIL SETUP
if (function_exists('imap_open')) {
require_once 'modules/Emails/Email.php';
require_once 'modules/InboundEmail/InboundEmail.php';
$ie = new InboundEmail();
$email = new Email();
$xtpl->assign('ROLLOVER', $email->rolloverStyle);
$xtpl->assign('IE_HIDE', '');
$xtpl->assign('IE_NAME', $focus->user_name);
$xtpl->assign('GROUP_ID', $focus->id);
$xtpl->assign('THEME', $theme);
$status = get_select_options_with_id($app_list_strings['user_status_dom'], '');
$mailbox_type = get_select_options_with_id($app_list_strings['dom_email_server_type'], '');
$mailbox = 'INBOX';
$beans = $ie->retrieveByGroupId($focus->id);
if (!empty($beans)) {
foreach ($beans as $bean) {
// default MAILBOX value
if (!empty($bean->mailbox)) {
$mailbox = $bean->mailbox;
示例9: InboundEmail
* 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".
********************************************************************************/
require_once 'include/DetailView/DetailView.php';
require_once 'include/SugarFolders/SugarFolders.php';
global $mod_strings;
global $app_strings;
global $sugar_config;
global $timedate;
global $theme;
/* start standard DetailView layout process */
$GLOBALS['log']->info("InboundEmails DetailView");
$focus = new InboundEmail();
$focus->retrieve($_REQUEST['record']);
if (empty($focus->id)) {
sugar_die($app_strings['ERROR_NO_RECORD']);
}
// if
$focus->checkImap();
$detailView = new DetailView();
$offset = 0;
echo get_module_title($mod_strings['LBL_MODULE_TITLE'], $mod_strings['LBL_MODULE_NAME'] . ": " . $focus->name, true);
/* end standard DetailView layout process */
$exServ = explode('::', $focus->service);
if ($focus->delete_seen == 1) {
$delete_seen = $mod_strings['LBL_MARK_READ_NO'];
} else {
$delete_seen = $mod_strings['LBL_MARK_READ_YES'];
示例10: InboundEmail
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo and "Supercharged by SuiteCRM" logo. If the display of the logos is not
* reasonably feasible for technical reasons, the Appropriate Legal Notices must
* display the words "Powered by SugarCRM" and "Supercharged by SuiteCRM".
********************************************************************************/
$_REQUEST['edit'] = 'true';
require_once 'include/SugarFolders/SugarFolders.php';
require_once 'include/templates/TemplateGroupChooser.php';
// GLOBALS
global $mod_strings;
global $app_strings;
global $app_list_strings;
global $current_user;
$focus = new InboundEmail();
$focus->checkImap();
$javascript = new Javascript();
$email = new Email();
/* Start standard EditView setup logic */
$domMailBoxType = $app_list_strings['dom_mailbox_type'];
if (isset($_REQUEST['record'])) {
$GLOBALS['log']->debug("In InboundEmail edit view, about to retrieve record: " . $_REQUEST['record']);
$result = $focus->retrieve($_REQUEST['record']);
if ($result == null) {
sugar_die($app_strings['ERROR_NO_RECORD']);
}
} else {
if (!empty($_REQUEST['mailbox_type'])) {
$focus->mailbox_type = $_REQUEST['mailbox_type'];
}
示例11: pollMonitoredInboxesForBouncedCampaignEmails
function pollMonitoredInboxesForBouncedCampaignEmails()
{
$GLOBALS['log']->info('----->Scheduler job of type pollMonitoredInboxesForBouncedCampaignEmails()');
global $dictionary;
$ie = new InboundEmail();
$r = $ie->db->query('SELECT id FROM inbound_email WHERE deleted=0 AND status=\'Active\' AND mailbox_type=\'bounce\'');
while ($a = $ie->db->fetchByAssoc($r)) {
$ieX = new InboundEmail();
$ieX->retrieve($a['id']);
$ieX->connectMailserver();
$GLOBALS['log']->info("Bounced campaign scheduler connected to mail server id: {$a['id']} ");
$newMsgs = array();
if ($ieX->isPop3Protocol()) {
$newMsgs = $ieX->getPop3NewMessagesToDownload();
} else {
$newMsgs = $ieX->getNewMessageIds();
}
//$newMsgs = $ieX->getNewMessageIds();
if (is_array($newMsgs)) {
foreach ($newMsgs as $k => $msgNo) {
$uid = $msgNo;
if ($ieX->isPop3Protocol()) {
$uid = $ieX->getUIDLForMessage($msgNo);
} else {
$uid = imap_uid($ieX->conn, $msgNo);
}
// else
$GLOBALS['log']->info("Bounced campaign scheduler will import message no: {$msgNo}");
$ieX->importOneEmail($msgNo, $uid, false, false);
}
}
imap_expunge($ieX->conn);
imap_close($ieX->conn);
}
return true;
}
示例12: InboundEmail
* SugarCRM" logo and "Supercharged by SuiteCRM" logo. If the display of the logos is not
* reasonably feasible for technical reasons, the Appropriate Legal Notices must
* display the words "Powered by SugarCRM" and "Supercharged by SuiteCRM".
********************************************************************************/
global $current_user;
if (isset($_REQUEST['type']) && $_REQUEST['type'] == 'personal') {
if ($current_user->hasPersonalEmail()) {
$ie = new InboundEmail();
$beans = $ie->retrieveByGroupId($current_user->id);
if (!empty($beans)) {
/** @var InboundEmail $bean */
foreach ($beans as $bean) {
$bean->importMessages();
}
}
}
header('Location: index.php?module=Emails&action=ListView&type=inbound&assigned_user_id=' . $current_user->id);
} elseif (isset($_REQUEST['type']) && $_REQUEST['type'] == 'group') {
$ie = new InboundEmail();
// this query only polls Group Inboxes
$r = $ie->db->query('SELECT inbound_email.id FROM inbound_email JOIN users ON inbound_email.group_id = users.id WHERE inbound_email.deleted=0 AND inbound_email.status = \'Active\' AND mailbox_type != \'bounce\' AND users.deleted = 0 AND users.is_group = 1');
while ($a = $ie->db->fetchByAssoc($r)) {
$ieX = new InboundEmail();
$ieX->retrieve($a['id']);
$ieX->importMessages();
}
header('Location: index.php?module=Emails&action=ListViewGroup');
} else {
// fail gracefully
header('Location: index.php?module=Emails&action=index');
}
示例13: InboundEmail
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo and "Supercharged by SuiteCRM" logo. If the display of the logos is not
* reasonably feasible for technical reasons, the Appropriate Legal Notices must
* display the words "Powered by SugarCRM" and "Supercharged by SuiteCRM".
********************************************************************************/
global $theme;
global $mod_strings;
global $app_list_strings;
global $current_user;
$focus = new InboundEmail();
$focus->checkImap();
///////////////////////////////////////////////////////////////////////////////
//// I-E SYSTEM SETTINGS
//// handle saving settings
if (isset($_REQUEST['save']) && $_REQUEST['save'] == 'true') {
$focus->saveInboundEmailSystemSettings('Case', $_REQUEST['inbound_email_case_macro']);
}
//// END I-E SYSTEM SETTINGS
///////////////////////////////////////////////////////////////////////////////
if (is_admin($current_user) && $_REQUEST['module'] != 'DynamicLayout' && !empty($_SESSION['editinplace'])) {
$ListView->setHeaderText("<a href='index.php?action=index&module=DynamicLayout&from_action=ListView&from_module=" . $_REQUEST['module'] . "'>" . SugarThemeRegistry::current()->getImage("EditLayout", "border='0' align='bottom'", null, null, '.gif', $mod_strings['LBL_EDIT_LAYOUT']) . "</a>");
}
$where = '';
$limit = '0';
$orderBy = 'date_entered';
示例14: listMailConfigurations
/**
* @access public
* @param User $user required
* @param Localization $locale
* @param string $charset
* @return array MailConfigurations
* @throws MailerException
*/
public static function listMailConfigurations(User $user, Localization $locale = null, $charset = null)
{
global $app_strings;
$outboundEmailConfigurations = array();
$ret = $user->getUsersNameAndEmail();
$systemDefaultOutbound = null;
if (empty($ret['email'])) {
$systemReturn = $user->getSystemDefaultNameAndEmail();
$ret['email'] = $systemReturn['email'];
$ret['name'] = $systemReturn['name'];
$system_replyToAddress = $ret['email'];
} else {
$system_replyToAddress = '';
}
$system_replyToName = $ret['name'];
$replyTo = $user->emailAddress->getReplyToAddress($user, true);
if (!empty($replyTo)) {
$system_replyToAddress = $replyTo;
}
/* Retrieve any Inbound User Mail Accounts and the Outbound Mail Accounts Associated with them */
$inboundEmail = new InboundEmail();
$ieAccounts = $inboundEmail->retrieveAllByGroupIdWithGroupAccounts($user->id);
$ie_ids = array_keys($ieAccounts);
foreach ($ieAccounts as $inbox_id => $ie) {
$name = $ie->get_stored_options('from_name');
$addr = $ie->get_stored_options('from_addr');
$storedOptions = unserialize(base64_decode($ie->stored_options));
$isAllowedGroup = $ie->get_stored_options('allow_outbound_group_usage', false);
if (!$ie->is_personal && !$isAllowedGroup) {
continue;
}
$outbound_config_id = empty($storedOptions["outbound_email"]) ? null : $storedOptions["outbound_email"];
$oe = null;
if (!empty($outbound_config_id)) {
$oe = static::loadOutboundEmail();
$oe->retrieve($outbound_config_id);
} else {
if (empty($systemDefaultOutbound)) {
$systemDefaultOutbound = self::getSystemMailConfiguration($user, $locale, $charset);
}
$outbound_config_id = $systemDefaultOutbound->getConfigId();
$oe = static::loadOutboundEmail();
$oe->retrieve($outbound_config_id);
}
if ($name != null && $addr != null && !empty($outbound_config_id) && !empty($oe) && $outbound_config_id == $oe->id) {
// turn the OutboundEmail object into a useable set of mail configurations
$configurations = array();
$configurations["config_id"] = $outbound_config_id;
$configurations["config_type"] = "user";
$configurations["inbox_id"] = $inbox_id;
$configurations["from_email"] = $addr;
$configurations["from_name"] = $name;
if ($isAllowedGroup) {
$configurations["display_name"] = "{$name} ({$addr}) - [" . $app_strings['LBL_GROUP_EMAIL_ACCOUNT_CONFIGURATION'] . "]";
} else {
$configurations["display_name"] = "{$name} ({$addr}) - [" . $app_strings['LBL_USER_OUTBOUND_EMAIL_ACCOUNT_CONFIGURATION'] . "]";
}
$configurations["personal"] = (bool) $ie->is_personal;
$configurations["replyto_email"] = !empty($storedOptions["reply_to_addr"]) ? $storedOptions["reply_to_addr"] : $addr;
$configurations["replyto_name"] = !empty($storedOptions["reply_to_name"]) ? $storedOptions["reply_to_name"] : $name;
$outboundEmailConfiguration = self::buildOutboundEmailConfiguration($user, $configurations, $oe, $locale, $charset);
$outboundEmailConfigurations[] = $outboundEmailConfiguration;
}
}
$systemUser = BeanFactory::getBean("Users");
$systemUser->getSystemUser();
$oe = static::loadOutboundEmail();
$systemMailerConfiguration = $oe->getSystemMailerSettings();
if ($oe->isAllowUserAccessToSystemDefaultOutbound()) {
$system = $systemMailerConfiguration;
$personal = false;
} else {
$system = $oe->getUsersMailerForSystemOverride($user->id);
$personal = true;
if (empty($system)) {
// Create a User System-Override Configuration
if ($user->id == $systemUser->id) {
$oe = $oe->createUserSystemOverrideAccount($user->id, $systemMailerConfiguration->mail_smtpuser, $systemMailerConfiguration->mail_smtppass);
} else {
$oe = $oe->createUserSystemOverrideAccount($user->id);
}
$system = $oe->getUsersMailerForSystemOverride($user->id);
}
}
if (empty($system->id)) {
throw new MailerException("No Valid Mail Configurations Found", MailerException::InvalidConfiguration);
}
// turn the OutboundEmail object into a useable set of mail configurations
$oe = static::loadOutboundEmail();
$oe->retrieve($system->id);
$configurations = array();
$configurations["config_id"] = $system->id;
//.........這裏部分代碼省略.........
示例15: sleep
<input name="close" type="button" title="' . $mod_strings['LBL_CLOSE_POPUP'] . '" value=" ' . $mod_strings['LBL_CLOSE_POPUP'] . ' " onClick="window.close()">
</form>
</td>
</tr>';
}
echo ' </table>';
sleep(1);
ob_flush();
flush();
ob_end_flush();
ob_start();
ob_flush();
flush();
ob_end_flush();
ob_start();
$ie = new InboundEmail();
$ie->email_user = $_REQUEST['email_user'];
$ie->server_url = $_REQUEST['server_url'];
$ie->port = $_REQUEST['port'];
$ie->protocol = $_REQUEST['protocol'];
$ie->email_password = str_rot13($_REQUEST['email_password']);
$ie->mailbox = $_REQUEST['mailbox'];
if ($_REQUEST['target'] == 'Popup') {
$msg = $ie->connectMailserver(true);
}
//// END COMMON CODE
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
//// COMPLETE RENDERING OF THE POPUP
echo '
<script type="text/javascript">