Replies to e-mails not linked to document

When I send e.g. a sales invoice, the e-mail is sent by and when the customer replies to the e-mail, it is shown in the Communications List, but it isn’t linked to the Sales Invoice document.

I assume this is because the reply-to address in the e-mail sent by ERPNext is also When the customer sends an email to the address that includes the Sales Invoice number (e.g., the received email gets correctly linked to the Sales Invoice.

Is there a setting such that the reply-to address includes the document number so replies by the customer automatically get linked to the correct document?

Hello Brontos

As I’ve been told, the linking works through the “message-id” in the email headers.

Any chance you are using office365?
Because we have issues with that too.

Interesting. We are not using office365; in the tests I did I was sending e-mails to/from my personal gmail address. But we use AWS to send e-mails from ERPNext, it may be possible that it modifies the headers. I will dig into it more.

The issue was using the Amazon SES SMTP server for sending e-mails. We changed to google ( and it works as expected now. The gmail SMTP server does not modify the Message-ID in the header, while Amazon SES does.

Dear @brontos ,

I’m sorry to bump this topic again, but I’m seeking clarification regarding the linking of email replies to documents when using Google SMTP. Specifically, I’m curious whether email replies are automatically linked documents (e.g., sales invoices) after you use Google SMTP.

This is my situation. I’m also utilizing Gmail SMTP and I confirm that the Message-ID header matches for both the received email and the server. However, despite the identical Message-IDs, replies aren’t automatically linked to the originating document. To circumvent this issue, I’ve resorted to manually adding a document reference (e.g., CRM-LEAD-XXXX-XXXXX) to every email sent. While this serves as a workaround, it’s cumbersome for regular users.

I appreciate your insights or suggestions regarding this matter.

Thank you!