mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-27 11:42:16 -05:00
Issue 3559: Use From or ReplyTo hostname in Message-ID if available.
I wrote this fix to avoid obviously specifying that I am using a mobile device to reply to an email. Others want this for ease of filtering messages from their host by Message-ID.
This commit is contained in:
parent
2fdcb77c5c
commit
7ac7fe2cfe
@ -313,8 +313,23 @@ public class MimeMessage extends Message {
|
||||
}
|
||||
|
||||
private String generateMessageId() {
|
||||
String hostname = null;
|
||||
if (mFrom != null) {
|
||||
int hostIdx = mFrom[0].getAddress().lastIndexOf("@");
|
||||
hostname = mFrom[0].getAddress().substring(hostIdx);
|
||||
}
|
||||
|
||||
if (hostname == null && mReplyTo != null) {
|
||||
int hostIdx = mReplyTo[0].getAddress().lastIndexOf("@");
|
||||
hostname = mReplyTo[0].getAddress().substring(hostIdx);
|
||||
}
|
||||
|
||||
if (hostname != null) {
|
||||
return "<" + UUID.randomUUID().toString() + hostname + ">";
|
||||
} else {
|
||||
return "<" + UUID.randomUUID().toString() + "@email.android.com>";
|
||||
}
|
||||
}
|
||||
|
||||
public void setMessageId(String messageId) throws UnavailableStorageException {
|
||||
setHeader("Message-ID", messageId);
|
||||
|
Loading…
Reference in New Issue
Block a user