mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-23 08:23:12 +01:00
make sure (or at least try) there is an emailaddress set for ident_email when fetching identities for the current user
This commit is contained in:
parent
f00530f7cb
commit
8b2a51b89f
@ -487,7 +487,7 @@ class emailadmin_account implements ArrayAccess
|
||||
|
||||
return new egw_db_callback_iterator($rs,
|
||||
// process each row
|
||||
function($row) use ($replace_placeholders, $field)
|
||||
function($row) use ($replace_placeholders, $field, $user)
|
||||
{
|
||||
// set email from imap-username (evtl. set from session, if acc_imap_logintype specified)
|
||||
if (in_array($field, array('name', 'ident_email', 'params')) &&
|
||||
@ -495,8 +495,7 @@ class emailadmin_account implements ArrayAccess
|
||||
{
|
||||
$row = array_merge($row, emailadmin_credentials::from_session($row));
|
||||
}
|
||||
if (empty($row['ident_email'])) $row['ident_email'] = $row['acc_imap_username'];
|
||||
|
||||
if (empty($row['ident_email'])||strpos($row['ident_email'],'@')===false) $row['ident_email'] = ($user == $GLOBALS['egw_info']['user']['account_id'] && $GLOBALS['egw_info']['user']['account_email']? $GLOBALS['egw_info']['user']['account_email'] :$row['acc_imap_username']);
|
||||
if ($field != 'name')
|
||||
{
|
||||
$data = $replace_placeholders ? array_merge($row, emailadmin_account::replace_placeholders($row)) : $row;
|
||||
|
@ -5433,6 +5433,24 @@ class emailadmin_imapbase
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* getStandardIdentityForProfile
|
||||
* get either the first identity out of the given identities or the one matching the profile_id
|
||||
* @param object $_identities identity iterator object with identities from emailadmin_account
|
||||
* @param integer $_profile_id the acc_id/profileID the identity with the matching key is the standard one
|
||||
* @return array the identity
|
||||
*/
|
||||
static function getStandardIdentityForProfile($_identities, $_profile_id)
|
||||
{
|
||||
$c = 0;
|
||||
// use the standardIdentity
|
||||
foreach($_identities as $key => $acc) {
|
||||
if ($c==0) $identity = $acc;
|
||||
if ($key==$_profile_id) $identity = $acc;
|
||||
$c++;
|
||||
}
|
||||
return $identity;
|
||||
}
|
||||
/**
|
||||
* createHeaderInfoSection - creates a textual headersection from headerobject
|
||||
* @param array header headerarray may contain SUBJECT,FROM,SENDER,TO,CC,BCC,DATE,PRIORITY,IMPORTANCE
|
||||
@ -5894,7 +5912,7 @@ class emailadmin_imapbase
|
||||
{
|
||||
$mailObject->ClearReplyTos();
|
||||
$activeMailProfiles = $this->mail->getAccountIdentities($this->profileID);
|
||||
$activeMailProfile = array_shift($activeMailProfiles);
|
||||
$activeMailProfile = self::getStandardIdentityForProfile($activeMailProfiles,$this->profileID);
|
||||
|
||||
$mailObject->AddReplyTo(self::$idna2->encode($activeMailProfile['ident_email']),emailadmin_imapbase::generateIdentityString($activeMailProfile,false));
|
||||
}
|
||||
@ -5916,7 +5934,7 @@ class emailadmin_imapbase
|
||||
$email = ($contact['email'] ? $contact['email'] : $contact['email_home']);
|
||||
$nfn = ($contact['n_fn'] ? $contact['n_fn'] : $contact['n_given'].' '.$contact['n_family']);
|
||||
$activeMailProfiles = $this->getAccountIdentities($this->profileID);
|
||||
$activeMailProfile = array_shift($activeMailProfiles);
|
||||
$activeMailProfile = self::getStandardIdentityForProfile($activeMailProfiles,$this->profileID);
|
||||
//error_log(__METHOD__.' ('.__LINE__.') '.array2string($activeMailProfile));
|
||||
$mailObject->From = $activeMailProfile['ident_email'];
|
||||
//$mailObject->From = $_identity->emailAddress;
|
||||
|
@ -440,7 +440,9 @@ class mail_activesync implements activesync_plugin_write, activesync_plugin_send
|
||||
// initialize our mail_bo
|
||||
if (!isset($this->mail)) $this->mail = mail_bo::getInstance(false,self::$profileID,true,false,true);
|
||||
$activeMailProfiles = $this->mail->getAccountIdentities(self::$profileID);
|
||||
$activeMailProfile = array_shift($activeMailProfiles);
|
||||
// use the standardIdentity
|
||||
$activeMailProfile = mail_bo::getStandardIdentityForProfile($activeMailProfiles,self::$profileID);
|
||||
|
||||
if ($this->debugLevel>2) debugLog(__METHOD__.__LINE__.' ProfileID:'.self::$profileID.' ActiveMailProfile:'.array2string($activeMailProfile));
|
||||
|
||||
// initialize the new egw_mailer object for sending
|
||||
|
Loading…
Reference in New Issue
Block a user