6.0.0-alpha12
6/12/25

[#14988] ActiveSync mail setting From: header
Summary ActiveSync mail setting From: header
Queue Synchronization
Queue Version FRAMEWORK_5_2
Type Bug
State Not Reproducible
Priority 1. Low
Owners
Requester 2020 (at) ichbinweg (dot) ch
Created 02/08/2020 (1951 days ago)
Due
Updated 07/19/2020 (1789 days ago)
Assigned 05/25/2020 (1844 days ago)
Resolved 07/19/2020 (1789 days ago)
Github Issue Link
Github Pull Request
Milestone
Patch No

History
07/19/2020 08:32:10 PM Michael Rubinsky State ⇒ Not Reproducible
 
06/07/2020 05:40:03 PM Michael Rubinsky Comment #6 Reply to this comment

[Show Quoted Text - 62 lines]
If that if is failing, then you need to figure out why 
_getIdentityFromAddress() is returning an empty value.  Use some debug 
logging in that method with Horde::debug() as so:

     protected function _getIdentityFromAddress()
     {
         global $prefs;

         $ident = $GLOBALS['injector']
             ->getInstance('Horde_Core_Factory_Identity')
             ->create($this->_user);

         $as_ident = $prefs->getValue('activesync_identity');
         $name = $ident->getValue('fullname', $as_ident == 'horde' ? 
$prefs->getValue('default_identity') : 
$prefs->getValue('activesync_identity'));
         $from_addr = $ident->getValue('from_addr', $as_ident == 
'horde' ? $prefs->getValue('default_identity') : 
$prefs->getValue('activesync_identity'));

        // ADD LOGGING
       Horde::debug($this->_user);  // This should output the Horde username.
       Horde::debug($from_addr);   // This should output the address 
you expect. If it doesn't, it's probably not the identity you think it 
is.
       Horde::debug($name);          // This should ouput the human 
readable username configured in the identity.


         if (empty($from_addr)) {
             return;
         }
         $rfc822 = new Horde_Mail_Rfc822_Address($from_addr);
         $rfc822->personal = $name;

         // ADD LOGGING
        Horde::debug($rfc822->encoded);  // If this is empty, probably 
something wrong with the format of the email address.

         return $rfc822->encoded;
     }


The log entries will be written to a file called horde_debug.txt 
located in your system's temporary directory (or the temp directory 
configured in Horde, if different).


06/03/2020 08:12:55 PM 2020 (at) ichbinweg (dot) ch Comment #5 Reply to this comment

[Show Quoted Text - 22 lines]
Yes, the default identity has an e-mail address set.

SELECT * FROM horde_prefs WHERE pref_name='activesync_identity';

in the SQL Shell delivers:

pref_uid         pref_scope         pref_name         pref_value
<username>         horde         activesync_identity         0

$ident=$injector->getInstance('Horde_Core_Factory_Identity')->create('<username>');
var_dump($ident->getValue('from_addr',0));

in the PHP shell correctly delivers the e-mail address set for the 
default identity. Still, this address is not set in the "From" header 
when sending messages via ActiveSync. Here an excerpt from 
Core/ActiveSync/Mail.php:

     public function setRawMessage(Horde_ActiveSync_Rfc822 $raw)
     {
         $this->_headers = $raw->getHeaders();

         // Attempt to always use the identity's From address, but fall back
           // to the device's sent value if it's not present.
         if ($from = $this->_getIdentityFromAddress()) {
             $this->_headers->removeHeader('From');
             $this->_headers->addHeader('From', $from);
         }

         // Reply-To?
           if ($replyto = $this->_getReplyToAddress()) {
             $this->_headers->addHeader('Reply-To', $replyto);
         }

         $this->_raw = $raw;
     }

The first "if" seems to fail so the "From" header is not removed and 
set to the default identity. How can I debug that one? Thanks for any 
help.
05/25/2020 06:21:03 PM Michael Rubinsky Comment #4
State ⇒ Feedback
Reply to this comment

Does the "Default Identity" entry have a "The default e-mail address 
to use with this identity:" value set?

Other things to try:
Use the administrative sql shell and execute:

SELECT * FROM horde_prefs WHERE pref_name='activesync_identity';

If you have something other than "use horde default" set in the prefs, 
this will be some number. Probably '0' for the original default 
identity.


Then, in the administrative PHP shell:

ident = 
$injector->getInstance('Horde_Core_Factory_Identity')->create('your_username_here');
var_dump($ident->getValue('from_addr', x);  // replace 'x' with the 
number returned from the query above.

This should output the email address that activesync will use as the 
From address of outgoing email.
05/24/2020 07:08:14 AM 2020 (at) ichbinweg (dot) ch Comment #3 Reply to this comment

[Show Quoted Text - 11 lines]
It's been a while, sorry for the late feedback. Can't get it to work 
here. Under "Global Preferences" > "Active Sync" my setting is 
"Default Identity" for "Identity to use when sending email via 
ActiveSync.". And I do have a default identity defined under 
"Preferences for Mail" > "Personal Information". Any hints, eventually 
also on how to debug are most welcome.
02/24/2020 03:50:42 AM Michael Rubinsky State ⇒ No Feedback
 
02/10/2020 12:42:00 AM Michael Rubinsky Comment #2
State ⇒ Feedback
Priority ⇒ 1. Low
Reply to this comment
The From: header of mail being sent through ActiveSync is not 
replaced with the information (address and full name) given by the 
identity chosen in the ActiveSync preferences. Only the (wrong) 
information sent by the client is passed through.
Cannot reproduce. Selecting an identity other than "Horde" in the 
ActiveSync preferences correctly replaces the From: header in the 
outgoing email.  Note that the activesync log will NOT show this 
replaced header, as it only shows what is being sent from the device.   
Looking at the email received by the recipient, I see the correct From 
header.
02/08/2020 02:30:50 PM 2020 (at) ichbinweg (dot) ch Comment #1
Priority ⇒ 3. High
State ⇒ Unconfirmed
Patch ⇒ No
Milestone ⇒
Queue ⇒ Synchronization
Summary ⇒ ActiveSync mail setting From: header
Type ⇒ Bug
Reply to this comment
The From: header of mail being sent through ActiveSync is not replaced 
with the information (address and full name) given by the identity 
chosen in the ActiveSync preferences. Only the (wrong) information 
sent by the client is passed through.

Saved Queries