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


PHP Email::retrieve方法代码示例

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


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

示例1: testEmailImport

 public function testEmailImport()
 {
     $this->_login();
     $nv = array('from_addr' => 'test@test.com', 'parent_type' => 'Accounts', 'parent_id' => $this->acc->id, 'description' => 'test', 'name' => 'Test Subject');
     $result = $this->_soapClient->call('set_entry', array('session' => $this->_sessionId, "module_name" => 'Emails', 'name_value_list' => $nv));
     $this->email_id = $result['id'];
     $email = new Email();
     $email->retrieve($this->email_id);
     $email->load_relationship('accounts');
     $acc = $email->accounts->get();
     $this->assertEquals($this->acc->id, $acc[0]);
 }
开发者ID:jgera,项目名称:sugarcrm_dev,代码行数:12,代码来源:Bug22504Test.php

示例2: linkLeadToEmail

 /**
  * Link the Lead to the Email from which the lead was created
  * Also set the assigned user to current user and mark email as read.
  * TODO: This logic is brought over from LeadFormBase->handleSave() - need refactoring to use Link2?
  *
  * @param $emailId
  * @param $leadId
  */
 protected function linkLeadToEmail($emailId, $leadId)
 {
     global $current_user;
     $email = new Email();
     $email->retrieve($emailId);
     $email->parent_type = 'Leads';
     $email->parent_id = $leadId;
     $email->assigned_user_id = $current_user->id;
     $email->status = 'read';
     $email->save();
     $email->load_relationship('leads');
     $email->leads->add($leadId);
 }
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:21,代码来源:LeadsApi.php

示例3: updateMail

 /**
  * @param $api
  * @param $args
  * @return array
  */
 public function updateMail($api, $args)
 {
     $email = new Email();
     if (isset($args['email_id']) && !empty($args['email_id'])) {
         if (!$email->retrieve($args['email_id']) || $email->id != $args['email_id']) {
             throw new SugarApiExceptionMissingParameter();
         }
         if ($email->status != 'draft') {
             throw new SugarApiExceptionRequestMethodFailure();
         }
     } else {
         throw new SugarApiExceptionInvalidParameter();
     }
     return $this->handleMail($api, $args);
 }
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:20,代码来源:MailApi.php

示例4: getQuotesRelatedData

function getQuotesRelatedData($bean)
{
    $return = array();
    $emailId = $_REQUEST['recordId'];
    require_once "modules/Emails/EmailUI.php";
    $email = new Email();
    $email->retrieve($emailId);
    $return['subject'] = $email->name;
    $return['body'] = from_html($email->description_html);
    $return['toAddress'] = $email->to_addrs;
    $ret = array();
    $ret['uid'] = $emailId;
    $ret = EmailUI::getDraftAttachments($ret);
    $return['attachments'] = $ret['attachments'];
    $return['email_id'] = $emailId;
    return $return;
}
开发者ID:nerdystudmuffin,项目名称:dashlet-subpanels,代码行数:17,代码来源:Compose.php

示例5: handleSave

 function handleSave($prefix, $redirect = true, $useRequired = false)
 {
     global $theme, $current_user;
     require_once 'include/formbase.php';
     global $timedate;
     $focus = new Contact();
     if ($useRequired && !checkRequired($prefix, array_keys($focus->required_fields))) {
         return null;
     }
     if (!empty($_POST[$prefix . 'new_reports_to_id'])) {
         $focus->retrieve($_POST[$prefix . 'new_reports_to_id']);
         $focus->reports_to_id = $_POST[$prefix . 'record'];
     } else {
         $focus = populateFromPost($prefix, $focus);
         if (!empty($focus->portal_password) && $focus->portal_password != $_POST[$prefix . 'old_portal_password']) {
             $focus->portal_password = md5($focus->portal_password);
         }
         if (!isset($_POST[$prefix . 'email_opt_out'])) {
             $focus->email_opt_out = 0;
         }
         if (!isset($_POST[$prefix . 'do_not_call'])) {
             $focus->do_not_call = 0;
         }
     }
     if (!$focus->ACLAccess('Save')) {
         ACLController::displayNoAccess(true);
         sugar_cleanup(true);
     }
     if ($_REQUEST['action'] != 'BusinessCard' && $_REQUEST['action'] != 'ConvertLead' && $_REQUEST['action'] != 'ConvertProspect') {
         if (!empty($_POST[$prefix . 'sync_contact'])) {
             $focus->contacts_users_id = $current_user->id;
         } else {
             if (!isset($focus->users)) {
                 $focus->load_relationship('user_sync');
             }
             $focus->contacts_users_id = null;
             $focus->user_sync->delete($focus->id, $current_user->id);
         }
     }
     if (isset($GLOBALS['check_notify'])) {
         $check_notify = $GLOBALS['check_notify'];
     } else {
         $check_notify = FALSE;
     }
     if (empty($_POST['dup_checked'])) {
         $duplicateContacts = $this->checkForDuplicates($prefix);
         if (isset($duplicateContacts)) {
             $location = 'module=Contacts&action=ShowDuplicates';
             $get = '';
             if (isset($_POST['inbound_email_id']) && !empty($_POST['inbound_email_id'])) {
                 $get .= '&inbound_email_id=' . $_POST['inbound_email_id'];
             }
             // Bug 25311 - Add special handling for when the form specifies many-to-many relationships
             if (isset($_POST['relate_to']) && !empty($_POST['relate_to'])) {
                 $get .= '&Contactsrelate_to=' . $_POST['relate_to'];
             }
             if (isset($_POST['relate_id']) && !empty($_POST['relate_id'])) {
                 $get .= '&Contactsrelate_id=' . $_POST['relate_id'];
             }
             //add all of the post fields to redirect get string
             foreach ($focus->column_fields as $field) {
                 if (!empty($focus->{$field}) && !is_object($focus->{$field})) {
                     $get .= "&Contacts{$field}=" . urlencode($focus->{$field});
                 }
             }
             foreach ($focus->additional_column_fields as $field) {
                 if (!empty($focus->{$field})) {
                     $get .= "&Contacts{$field}=" . urlencode($focus->{$field});
                 }
             }
             if ($focus->hasCustomFields()) {
                 foreach ($focus->field_defs as $name => $field) {
                     if (!empty($field['source']) && $field['source'] == 'custom_fields') {
                         $get .= "&Contacts{$name}=" . urlencode($focus->{$name});
                     }
                 }
             }
             $emailAddress = new SugarEmailAddress();
             $get .= $emailAddress->getFormBaseURL($focus);
             //create list of suspected duplicate contact id's in redirect get string
             $i = 0;
             foreach ($duplicateContacts as $contact) {
                 $get .= "&duplicate[{$i}]=" . $contact['id'];
                 $i++;
             }
             //add return_module, return_action, and return_id to redirect get string
             $get .= "&return_module=";
             if (!empty($_POST['return_module'])) {
                 $get .= $_POST['return_module'];
             } else {
                 $get .= "Contacts";
             }
             $get .= "&return_action=";
             if (!empty($_POST['return_action'])) {
                 $get .= $_POST['return_action'];
             }
             //else $get .= "DetailView";
             if (!empty($_POST['return_id'])) {
                 $get .= "&return_id=" . $_POST['return_id'];
             }
//.........这里部分代码省略.........
开发者ID:razorinc,项目名称:sugarcrm-example,代码行数:101,代码来源:ContactFormBase.php

示例6: handleSave

 function handleSave($prefix, $redirect = true, $useRequired = false, $do_save = true, $exist_lead = null)
 {
     require_once 'modules/Campaigns/utils.php';
     require_once 'include/formbase.php';
     if (empty($exist_lead)) {
         $focus = new Lead();
     } else {
         $focus = $exist_lead;
     }
     if ($useRequired && !checkRequired($prefix, array_keys($focus->required_fields))) {
         return null;
     }
     $focus = populateFromPost($prefix, $focus);
     if (!$focus->ACLAccess('Save')) {
         ACLController::displayNoAccess(true);
         sugar_cleanup(true);
     }
     if (!isset($_POST[$prefix . 'email_opt_out'])) {
         $focus->email_opt_out = 0;
     }
     if (!isset($_POST[$prefix . 'do_not_call'])) {
         $focus->do_not_call = 0;
     }
     if ($do_save) {
         if (!empty($GLOBALS['check_notify'])) {
             $focus->save($GLOBALS['check_notify']);
         } else {
             $focus->save(FALSE);
         }
     }
     $return_id = $focus->id;
     if (isset($_POST[$prefix . 'prospect_id']) && !empty($_POST[$prefix . 'prospect_id'])) {
         $prospect = new Prospect();
         $prospect->retrieve($_POST[$prefix . 'prospect_id']);
         $prospect->lead_id = $focus->id;
         $prospect->save();
         //if prospect id exists, make sure we are coming from prospect detail
         if (strtolower($_POST['return_module']) == 'prospects' && strtolower($_POST['return_action']) == 'detailview') {
             //create campaing_log entry
             if (isset($focus->campaign_id) && $focus->campaign_id != null) {
                 campaign_log_lead_entry($focus->campaign_id, $prospect, $focus, 'lead');
             }
         }
     }
     ///////////////////////////////////////////////////////////////////////////////
     ////	INBOUND EMAIL HANDLING
     ///////////////////////////////////////////////////////////////////////////////
     if (isset($_REQUEST['inbound_email_id']) && !empty($_REQUEST['inbound_email_id'])) {
         if (!isset($current_user)) {
             global $current_user;
         }
         // fake this case like it's already saved.
         $email = new Email();
         $email->retrieve($_REQUEST['inbound_email_id']);
         $email->parent_type = 'Leads';
         $email->parent_id = $focus->id;
         $email->assigned_user_id = $current_user->id;
         $email->status = 'read';
         $email->save();
         $email->load_relationship('leads');
         $email->leads->add($focus->id);
         header("Location: index.php?&module=Emails&action=EditView&type=out&inbound_email_id=" . $_REQUEST['inbound_email_id'] . "&parent_id=" . $email->parent_id . "&parent_type=" . $email->parent_type . '&start=' . $_REQUEST['start']);
         exit;
     }
     ////	END INBOUND EMAIL HANDLING
     ///////////////////////////////////////////////////////////////////////////////
     $GLOBALS['log']->debug("Saved record with id of " . $return_id);
     if ($redirect) {
         handleRedirect($return_id, 'Leads');
     } else {
         return $focus;
     }
 }
开发者ID:sysraj86,项目名称:carnivalcrm,代码行数:73,代码来源:LeadFormBase.php

示例7: importOneEmail


//.........这里部分代码省略.........
         // this is used in Contacts' Emails SubPanel
         if (!empty($header->toaddress)) {
             $email->to_name = $this->handleTranserEncoding($this->handleMimeHeaderDecode($header->toaddress), $structure->encoding);
         }
         if (!empty($header->to)) {
             $email->to_addrs = $this->convertImapToSugarEmailAddress($header->to);
         }
         $email->from_name = $this->handleTranserEncoding($this->handleMimeHeaderDecode($header->fromaddress), $structure->encoding);
         $email->from_addr = $this->convertImapToSugarEmailAddress($header->from);
         if (!empty($header->cc)) {
             $email->cc_addrs = $this->convertImapToSugarEmailAddress($header->cc);
         }
         $email->reply_to_name = $this->handleTranserEncoding($this->handleMimeHeaderDecode($header->reply_toaddress), $structure->encoding);
         $email->reply_to_email = $this->convertImapToSugarEmailAddress($header->reply_to);
         $email->intent = $this->mailbox_type;
         $email->message_id = $this->compoundMessageId;
         // filled by importDupeCheck();
         // handle multi-part email bodies
         $email->description = $this->getMessageText($msgNo, 'PLAIN', $structure, $fullHeader);
         // runs through handleTranserEncoding() already
         $email->description_html = $this->getMessageText($msgNo, 'HTML', $structure, $fullHeader);
         // runs through handleTranserEncoding() already
         // empty() check for body content
         if (empty($email->description)) {
             $GLOBALS['log']->debug('InboundEmail Message (id:' . $email->message_id . ') has no body');
         }
         // assign_to group
         $email->assigned_user_id = $this->group_id;
         $email->save();
         $email->new_with_id = false;
         // to allow future saves by UPDATE, instead of INSERT
         ////	ASSIGN APPROPRIATE ATTRIBUTES TO NEW EMAIL OBJECT
         ///////////////////////////////////////////////////////////////////
         ///////////////////////////////////////////////////////////////////
         ////	HANDLE EMAIL ATTACHEMENTS OR HTML TEXT
         // parts defines attachements - be mindful of .html being interpreted as an attachment
         if ($structure->type == 1 && !empty($structure->parts)) {
             $GLOBALS['log']->debug('InboundEmail found multipart email - saving attachments if found.');
             $this->saveAttachments($msgNo, $structure->parts, $email->id);
         } elseif ($structure->type == 0) {
             $uuemail = $this->isUuencode($email->description) ? true : false;
             /*
              * UUEncoded attachments - legacy, but still have to deal with it
              * format:
              * begin 777 filename.txt
              * UUENCODE
              *
              * end
              */
             // set body to the filtered one
             if ($uuemail) {
                 $email->description = $this->handleUUEncodedEmailBody($email->description, $email->id);
                 $email->retrieve($email->id);
                 $email->save();
             }
         } else {
             if ($this->port != 110) {
                 $GLOBALS['log']->debug('InboundEmail found a multi-part email (id:' . $messageId . ') with no child parts to parse.');
             } else {
                 $GLOBALS['log']->debug('InboundEmail found a multi-part email with no child parts to parse - BUT we\'re using POP3, so we suck.');
             }
         }
         ////	END HANDLE EMAIL ATTACHEMENTS OR HTML TEXT
         ///////////////////////////////////////////////////////////////////
         ///////////////////////////////////////////////////////////////////
         ////	LINK APPROPRIATE BEANS TO NEWLY SAVED EMAIL
         $contactAddr = $this->handleLinking($email);
         ////	END LINK APPROPRIATE BEANS TO NEWLY SAVED EMAIL
         ///////////////////////////////////////////////////////////////////
         ///////////////////////////////////////////////////////////////////
         ////	MAILBOX TYPE HANDLING
         $this->handleMailboxType($email, $header);
         ////	END MAILBOX TYPE HANDLING
         ///////////////////////////////////////////////////////////////////
         ///////////////////////////////////////////////////////////////////
         ////	SEND AUTORESPONSE
         $this->handleAutoresponse($email, $contactAddr);
         ////	END SEND AUTORESPONSE
         ///////////////////////////////////////////////////////////////////
         ////	END IMPORT ONE EMAIL
         ///////////////////////////////////////////////////////////////////
     } else {
         // only log if not POP3; pop3 iterates through ALL mail
         if ($this->protocol != 'pop3') {
             $GLOBALS['log']->info("InboundEmail found a duplicate email: " . $header->message_id);
         }
     }
     ////	END DUPLICATE CHECK
     ///////////////////////////////////////////////////////////////////////
     ///////////////////////////////////////////////////////////////////////
     ////	DEAL WITH THE MAILBOX
     imap_setflag_full($this->conn, $msgNo, '\\SEEN');
     // if delete_seen, mark msg as deleted
     if ($this->delete_seen == 1) {
         imap_setflag_full($this->conn, $msgNo, '\\DELETED');
     }
     $GLOBALS['log']->debug('********************************* InboundEmail finished import of 1 email: ' . $email->name);
     ////	END DEAL WITH THE MAILBOX
     ///////////////////////////////////////////////////////////////////////
 }
开发者ID:BackupTheBerlios,项目名称:livealphaprint,代码行数:101,代码来源:InboundEmail.php

示例8: moveEmails

 /**
  * moves emails from folder to folder
  * @param string $fromIe I-E id
  * @param string $fromFolder IMAP path to folder in which the email lives
  * @param string $toIe I-E id
  * @param string $toFolder
  * @param string $uids UIDs of emails to move, either Sugar GUIDS or IMAP
  * UIDs
  * @param bool $copy Default false
  * @return bool True on successful execution
  */
 function moveEmails($fromIe, $fromFolder, $toIe, $toFolder, $uids, $copy = false)
 {
     global $app_strings;
     global $current_user;
     // same I-E server
     if ($fromIe == $toIe) {
         $GLOBALS['log']->debug("********* SUGARFOLDER - moveEmails() moving email from I-E to I-E");
         //$exDestFolder = explode("::", $toFolder);
         //preserve $this->mailbox
         if (isset($this->mailbox)) {
             $oldMailbox = $this->mailbox;
         }
         $this->retrieve($fromIe);
         $this->mailbox = $fromFolder;
         $this->connectMailserver();
         $exUids = explode('::;::', $uids);
         $uids = implode(",", $exUids);
         // imap_mail_move accepts comma-delimited lists of UIDs
         if ($copy) {
             if (imap_mail_copy($this->conn, $uids, $toFolder, CP_UID)) {
                 $this->mailbox = $toFolder;
                 $this->connectMailserver();
                 $newOverviews = imap_fetch_overview($this->conn, $uids, FT_UID);
                 $this->updateOverviewCacheFile($newOverviews, 'append');
                 if (isset($oldMailbox)) {
                     $this->mailbox = $oldMailbox;
                 }
                 return true;
             } else {
                 $GLOBALS['log']->debug("INBOUNDEMAIL: could not imap_mail_copy() [ {$uids} ] to folder [ {$toFolder} ] from folder [ {$fromFolder} ]");
             }
         } else {
             if (imap_mail_move($this->conn, $uids, $toFolder, CP_UID)) {
                 $GLOBALS['log']->info("INBOUNDEMAIL: imap_mail_move() [ {$uids} ] to folder [ {$toFolder} ] from folder [ {$fromFolder} ]");
                 imap_expunge($this->conn);
                 // hard deletes moved messages
                 // update cache on fromFolder
                 $newOverviews = $this->getOverviewsFromCacheFile($uids, $fromFolder, true);
                 $this->deleteCachedMessages($uids, $fromFolder);
                 // update cache on toFolder
                 $this->checkEmailOneMailbox($toFolder, true, true);
                 if (isset($oldMailbox)) {
                     $this->mailbox = $oldMailbox;
                 }
                 return true;
             } else {
                 $GLOBALS['log']->debug("INBOUNDEMAIL: could not imap_mail_move() [ {$uids} ] to folder [ {$toFolder} ] from folder [ {$fromFolder} ]");
             }
         }
     } elseif ($toIe == 'folder' && $fromFolder == 'sugar::Emails') {
         $GLOBALS['log']->debug("********* SUGARFOLDER - moveEmails() moving email from SugarFolder to SugarFolder");
         // move from sugar folder to sugar folder
         require_once "include/SugarFolders/SugarFolders.php";
         $sugarFolder = new SugarFolder();
         $exUids = explode($app_strings['LBL_EMAIL_DELIMITER'], $uids);
         foreach ($exUids as $id) {
             if ($copy) {
                 $sugarFolder->copyBean($fromIe, $toFolder, $id, "Emails");
             } else {
                 $fromSugarFolder = new SugarFolder();
                 $fromSugarFolder->retrieve($fromIe);
                 $toSugarFolder = new SugarFolder();
                 $toSugarFolder->retrieve($toFolder);
                 $email = new Email();
                 $email->retrieve($id);
                 $email->status = 'unread';
                 // when you move from My Emails to Group Folder, Assign To field for the Email should become null
                 if ($fromSugarFolder->is_dynamic && $toSugarFolder->is_group) {
                     $email->assigned_user_id = "";
                     $email->save();
                     if (!$toSugarFolder->checkEmailExistForFolder($id)) {
                         $fromSugarFolder->deleteEmailFromAllFolder($id);
                         $toSugarFolder->addBean($email);
                     }
                 } elseif ($fromSugarFolder->is_group && $toSugarFolder->is_dynamic) {
                     $fromSugarFolder->deleteEmailFromAllFolder($id);
                     $email->assigned_user_id = $current_user->id;
                     $email->save();
                 } else {
                     // If you are moving something from personal folder then delete an entry from all folder
                     if (!$fromSugarFolder->is_dynamic && !$fromSugarFolder->is_group) {
                         $fromSugarFolder->deleteEmailFromAllFolder($id);
                     }
                     // if
                     if ($fromSugarFolder->is_dynamic && !$toSugarFolder->is_dynamic && !$toSugarFolder->is_group) {
                         $email->assigned_user_id = "";
                         $toSugarFolder->addBean($email);
                     }
                     // if
//.........这里部分代码省略.........
开发者ID:netconstructor,项目名称:sugarcrm_dev,代码行数:101,代码来源:InboundEmail.php

示例9: send


//.........这里部分代码省略.........
     } 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"
         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.
                 $file_location = $file_location . ".txt";
                 break;
                 // no need to look for more
             }
         }
         $mail->AddAttachment($file_location, $locale->translateCharsetMIME(trim($filename), 'UTF-8', $OBCharset), 'base64', $mime_type);
         // embedded Images
         if ($note->embed_flag == true) {
             $cid = $filename;
             $mail->AddEmbeddedImage($file_location, $cid, $filename, 'base64', $mime_type);
         }
     }
     ////	END ATTACHMENTS
     ///////////////////////////////////////////////////////////////////////
     $mail = $this->handleBody($mail);
     $GLOBALS['log']->debug('Email sending --------------------- ');
     ///////////////////////////////////////////////////////////////////////
     ////	I18N TRANSLATION
     $mail->prepForOutbound();
     ////	END I18N TRANSLATION
     ///////////////////////////////////////////////////////////////////////
     if ($mail->Send()) {
         ///////////////////////////////////////////////////////////////////
         ////	INBOUND EMAIL HANDLING
         // mark replied
         if (!empty($_REQUEST['inbound_email_id'])) {
             $ieMail = new Email();
             $ieMail->retrieve($_REQUEST['inbound_email_id']);
             $ieMail->status = 'replied';
             $ieMail->save();
         }
         $GLOBALS['log']->debug(' --------------------- buh bye -- sent successful');
         ////	END INBOUND EMAIL HANDLING
         ///////////////////////////////////////////////////////////////////
         return true;
     }
     $GLOBALS['log']->debug($app_strings['LBL_EMAIL_ERROR_PREPEND'] . $mail->ErrorInfo);
     return false;
 }
开发者ID:rgauss,项目名称:sugarcrm_dev,代码行数:101,代码来源:Email.php

示例10: distDirect

 /**
  * distributes emails to 1 user
  * @param	$user		users to dist to
  * @param	$mailIds	array of email ids to push
  * @return  boolean		true on success
  */
 function distDirect($user, $mailIds)
 {
     foreach ($mailIds as $k => $mailId) {
         $email = new Email();
         $email->retrieve($mailId);
         $email->assigned_user_id = $user;
         $email->status = 'unread';
         $email->save();
     }
     return true;
 }
开发者ID:NALSS,项目名称:SuiteCRM,代码行数:17,代码来源:EmailUI.php

示例11: Email

 * 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".
 ********************************************************************************/
global $current_user;
$focus = new Email();
// Get Group User IDs
$groupUserQuery = 'SELECT name, group_id FROM inbound_email ie INNER JOIN users u ON (ie.group_id = u.id AND u.is_group = 1)';
_pp($groupUserQuery);
$r = $focus->db->query($groupUserQuery);
$groupIds = '';
while ($a = $focus->db->fetchByAssoc($r)) {
    $groupIds .= "'" . $a['group_id'] . "', ";
}
$groupIds = substr($groupIds, 0, strlen($groupIds) - 2);
$query = 'SELECT emails.id AS id FROM emails';
$query .= " WHERE emails.deleted = 0 AND emails.status = 'unread' AND emails.assigned_user_id IN ({$groupIds})";
//$query .= ' LIMIT 1';
//_ppd($query);
$r2 = $focus->db->query($query);
$count = 0;
$a2 = $focus->db->fetchByAssoc($r2);
$focus->retrieve($a2['id']);
$focus->assigned_user_id = $current_user->id;
$focus->save();
if (!empty($a2['id'])) {
    header('Location: index.php?module=Emails&action=ListView&type=inbound&assigned_user_id=' . $current_user->id);
} else {
    header('Location: index.php?module=Emails&action=ListView&show_error=true&type=inbound&assigned_user_id=' . $current_user->id);
}
开发者ID:delkyd,项目名称:sugarcrm_dev,代码行数:31,代码来源:Grab.php

示例12: getClassicModuleTitle

 * 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): ______________________________________..
 ********************************************************************************/
global $mod_strings;
global $app_strings;
$focus = new Email();
if (!empty($_REQUEST['record'])) {
    $result = $focus->retrieve($_REQUEST['record']);
    if ($result == null) {
        sugar_die($app_strings['ERROR_NO_RECORD']);
    }
} else {
    header("Location: index.php?module=Emails&action=index");
}
//needed when creating a new email with default values passed in
if (isset($_REQUEST['contact_name']) && is_null($focus->contact_name)) {
    $focus->contact_name = $_REQUEST['contact_name'];
}
if (isset($_REQUEST['contact_id']) && is_null($focus->contact_id)) {
    $focus->contact_id = $_REQUEST['contact_id'];
}
echo getClassicModuleTitle($mod_strings['LBL_SEND'], array($mod_strings['LBL_SEND']), true);
$GLOBALS['log']->info("Email detail view");
开发者ID:netconstructor,项目名称:sugarcrm_dev,代码行数:31,代码来源:Status.php

示例13: handleSave

 function handleSave($prefix, $redirect = true, $useRequired = false)
 {
     global $theme, $current_user;
     $theme_path = "themes/" . $theme . "/";
     require_once 'modules/Contacts/Contact.php';
     require_once $theme_path . 'layout_utils.php';
     require_once 'include/utils.php';
     require_once 'include/formbase.php';
     require_once 'XTemplate/xtpl.php';
     global $timedate;
     $focus = new Contact();
     if ($useRequired && !checkRequired($prefix, array_keys($focus->required_fields))) {
         return null;
     }
     if (!empty($_POST[$prefix . 'new_reports_to_id'])) {
         $focus->retrieve($_POST[$prefix . 'new_reports_to_id']);
         $focus->reports_to_id = $_POST[$prefix . 'record'];
     } else {
         $focus = populateFromPost($prefix, $focus);
         if (isset($focus->portal_password) && $focus->portal_password != $_POST[$prefix . 'old_portal_password']) {
             $focus->portal_password = md5($focus->portal_password);
         }
         if (!isset($_POST[$prefix . 'email_opt_out'])) {
             $focus->email_opt_out = 'off';
         }
         if (!isset($_POST[$prefix . 'do_not_call'])) {
             $focus->do_not_call = 'off';
         }
     }
     if (!$focus->ACLAccess('Save')) {
         ACLController::displayNoAccess(true);
         sugar_cleanup(true);
     }
     if ($_REQUEST['action'] != 'BusinessCard' && $_REQUEST['action'] != 'ConvertLead' && $_REQUEST['action'] != 'ConvertProspect') {
         if (isset($_POST[$prefix . 'sync_contact'])) {
             $focus->contacts_users_id = $current_user->id;
         } else {
             if (!isset($focus->users)) {
                 $focus->load_relationship('user_sync');
             }
             $focus->contacts_users_id = null;
             $focus->user_sync->delete($focus->id, $current_user->id);
         }
     }
     if (isset($GLOBALS['check_notify'])) {
         $check_notify = $GLOBALS['check_notify'];
     } else {
         $check_notify = FALSE;
     }
     if (empty($_POST['record']) && empty($_POST['dup_checked'])) {
         $duplicateContacts = $this->checkForDuplicates($prefix);
         if (isset($duplicateContacts)) {
             $get = 'module=Contacts&action=ShowDuplicates';
             if (isset($_POST['inbound_email_id']) && !empty($_POST['inbound_email_id'])) {
                 $get .= '&inbound_email_id=' . $_POST['inbound_email_id'];
             }
             //add all of the post fields to redirect get string
             foreach ($focus->column_fields as $field) {
                 if (!empty($focus->{$field})) {
                     $get .= "&Contacts{$field}=" . urlencode($focus->{$field});
                 }
             }
             foreach ($focus->additional_column_fields as $field) {
                 if (!empty($focus->{$field})) {
                     $get .= "&Contacts{$field}=" . urlencode($focus->{$field});
                 }
             }
             //create list of suspected duplicate contact id's in redirect get string
             $i = 0;
             foreach ($duplicateContacts as $contact) {
                 $get .= "&duplicate[{$i}]=" . $contact['id'];
                 $i++;
             }
             //add return_module, return_action, and return_id to redirect get string
             $get .= "&return_module=";
             if (!empty($_POST['return_module'])) {
                 $get .= $_POST['return_module'];
             } else {
                 $get .= "Contacts";
             }
             $get .= "&return_action=";
             if (!empty($_POST['return_action'])) {
                 $get .= $_POST['return_action'];
             } else {
                 $get .= "DetailView";
             }
             if (!empty($_POST['return_id'])) {
                 $get .= "&return_id=" . $_POST['return_id'];
             }
             if (!empty($_POST['popup'])) {
                 $get .= '&popup=' . $_POST['popup'];
             }
             if (!empty($_POST['create'])) {
                 $get .= '&create=' . $_POST['create'];
             }
             // for InboundEmail flow
             if (!empty($_POST['start'])) {
                 $get .= '&start=' . $_POST['start'];
             }
             //now redirect the post to modules/Contacts/ShowDuplicates.php
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:livealphaprint,代码行数:101,代码来源:ContactFormBase.php

示例14: Email

 * details.
 * 
 * You should have received a copy of the GNU Affero General Public License along with
 * this program; if not, see http://www.gnu.org/licenses or write to the Free
 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 * 02110-1301 USA.
 * 
 * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
 * SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
 * 
 * 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. If the display of the logo is not reasonably feasible for
 * technical reasons, the Appropriate Legal Notices must display the words
 * "Powered by SugarCRM".
 ********************************************************************************/
if (isset($_REQUEST['mode']) && $_REQUEST['mode'] == 'show_raw') {
    if (!class_exists("Email")) {
    }
    $email = new Email();
    $email->retrieve($_REQUEST['metadata']);
    echo nl2br(SugarCleaner::cleanHtml($email->raw_source));
} else {
    require_once 'include/Popups/Popup_picker.php';
    $popup = new Popup_Picker();
    echo $popup->process_page();
}
开发者ID:omusico,项目名称:sugar_work,代码行数:31,代码来源:Popup.php

示例15: handleSave

 function handleSave($prefix, $redirect = true, $useRequired = false)
 {
     require_once 'modules/Leads/Lead.php';
     require_once 'include/formbase.php';
     $focus = new Lead();
     if ($useRequired && !checkRequired($prefix, array_keys($focus->required_fields))) {
         return null;
     }
     $focus = populateFromPost($prefix, $focus);
     if (!$focus->ACLAccess('Save')) {
         ACLController::displayNoAccess(true);
         sugar_cleanup(true);
     }
     if (!isset($_POST[$prefix . 'email_opt_out'])) {
         $focus->email_opt_out = 'off';
     }
     if (!isset($_POST[$prefix . 'do_not_call'])) {
         $focus->do_not_call = 'off';
     }
     if (!empty($GLOBALS['check_notify'])) {
         $focus->save($GLOBALS['check_notify']);
     } else {
         $focus->save(FALSE);
     }
     $return_id = $focus->id;
     if (isset($_POST[$prefix . 'prospect_id']) && !empty($_POST[$prefix . 'prospect_id'])) {
         if (!class_exists('Prospect')) {
             require_once 'modules/Prospects/Prospect.php';
         }
         $prospect = new Prospect();
         $prospect->retrieve($_POST[$prefix . 'prospect_id']);
         $prospect->lead_id = $focus->id;
         $prospect->save();
         $linked_beans = $prospect->get_linked_beans('campaigns', 'CampaignLog');
         if (empty($linked_beans)) {
             $linked_beans = array();
         }
         foreach ($linked_beans as $thebean) {
             $thebean->id = null;
             $thebean->target_id = $focus->id;
             $thebean->target_type = 'Leads';
             $thebean->archived = 1;
             $thebean->save();
         }
     }
     ///////////////////////////////////////////////////////////////////////////////
     ////	INBOUND EMAIL HANDLING
     ///////////////////////////////////////////////////////////////////////////////
     if (isset($_REQUEST['inbound_email_id']) && !empty($_REQUEST['inbound_email_id'])) {
         if (!isset($current_user)) {
             global $current_user;
         }
         // fake this case like it's already saved.
         require_once 'modules/Emails/Email.php';
         $email = new Email();
         $email->retrieve($_REQUEST['inbound_email_id']);
         $email->parent_type = 'Leads';
         $email->parent_id = $focus->id;
         $email->assigned_user_id = $current_user->id;
         $email->status = 'read';
         $email->save();
         $email->load_relationship('leads');
         $email->leads->add($focus->id);
         header("Location: index.php?&module=Emails&action=EditView&type=out&inbound_email_id=" . $_REQUEST['inbound_email_id'] . "&parent_id=" . $email->parent_id . "&parent_type=" . $email->parent_type . '&start=' . $_REQUEST['start']);
         exit;
     }
     ////	END INBOUND EMAIL HANDLING
     ///////////////////////////////////////////////////////////////////////////////
     $GLOBALS['log']->debug("Saved record with id of " . $return_id);
     if ($redirect) {
         handleRedirect($return_id, 'Leads');
     } else {
         return $focus;
     }
 }
开发者ID:BackupTheBerlios,项目名称:livealphaprint,代码行数:75,代码来源:LeadFormBase.php


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