mirror of
https://github.com/moparisthebest/k-9
synced 2025-02-25 07:01:50 -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,7 +313,22 @@ public class MimeMessage extends Message {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private String generateMessageId() {
|
private String generateMessageId() {
|
||||||
return "<" + UUID.randomUUID().toString() + "@email.android.com>";
|
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 {
|
public void setMessageId(String messageId) throws UnavailableStorageException {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user