Use domain name for message IDs

This commit is contained in:
M66B
2020-05-19 07:36:41 +02:00
parent 0aa7addb7a
commit 121236a5d6
2 changed files with 14 additions and 1 deletions

View File

@@ -58,6 +58,7 @@ import javax.mail.MessageRemovedException;
import javax.mail.MessagingException;
import javax.mail.SendFailedException;
import javax.mail.Session;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;
import static android.os.Process.THREAD_PRIORITY_BACKGROUND;
@@ -405,6 +406,14 @@ public class ServiceSend extends ServiceBase {
if (!message.content)
throw new IllegalArgumentException("Message body missing");
// Update message ID
if (message.from != null && message.from.length > 0) {
String from = ((InternetAddress) message.from[0]).getAddress();
int at = (from == null ? -1 : from.indexOf('@'));
if (at > 0 && at + 1 < from.length())
message.msgid = EntityMessage.generateMessageId(from.substring(at + 1));
}
// Create message
Properties props = MessageHelper.getSessionProperties();
if (ident.unicode)