diff --git a/CHANGELOG b/CHANGELOG index ac311ca67..a8478f31e 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -7,6 +7,7 @@ CHANGELOG Roundcube Webmail - Fix bug where consecutive LDAP searches could return wrong results (#8064) - Fix bug where plus characters in attachment filename could have been ignored (#8074) - Fix displaying HTML body with inline images encapsulated using TNEF format (winmail.dat) +- Fix handling of custom sender addresses with names (#8106) RELEASE 1.4.11 -------------- diff --git a/program/include/rcmail_sendmail.php b/program/include/rcmail_sendmail.php index e529d29ab..180b4d09f 100644 --- a/program/include/rcmail_sendmail.php +++ b/program/include/rcmail_sendmail.php @@ -136,15 +136,18 @@ class rcmail_sendmail $from = null; } } - // ... if there is no identity record, this might be a custom from - else if (($from_string = $this->email_input_format($from)) - && preg_match('/(\S+@\S+)/', $from_string, $m) - ) { - $from = trim($m[1], '<>'); - } - // ... otherwise it's empty or invalid else { - $from = null; + // ... if there is no identity record, this might be a custom from + $from_addresses = rcube_mime::decode_address_list($from); + + if (count($from_addresses) == 1) { + $from = $from_addresses[1]['mailto']; + $from_string = $from_addresses[1]['string']; + } + // ... otherwise it's empty or invalid + else { + $from = null; + } } // check 'From' address (identity may be incomplete)