Don't remove fromUser email from From header

If user had not enabled 'CC me on comments I write' then emails sent
from user would have user email stripped out of From header, possibly
resulting in an empty From header.

This unintuitive behavior is surely a bug.

Bug: Issue 4051
Change-Id: I8eb53bbf902233c221eaf830fff0ec71147545ce
This commit is contained in:
dodgejoel
2016-04-09 16:09:09 -07:00
committed by David Pursehouse
parent 8fe76c5687
commit a79f693ccc

View File

@@ -494,9 +494,10 @@ public abstract class OutgoingEmail {
j.remove();
}
}
for (EmailHeader hdr : headers.values()) {
if (hdr instanceof AddressList) {
((AddressList) hdr).remove(fromEmail);
for (Map.Entry<String, EmailHeader> entry : headers.entrySet()) {
// Don't remove fromEmail from the "From" header though!
if (entry.getValue() instanceof AddressList && entry.getKey() != "From") {
((AddressList) entry.getValue()).remove(fromEmail);
}
}
}