~emersion/alps-dev

Set Message-Id header v2 APPLIED

Jesse Olson: 1
 Set Message-Id header

 1 files changed, 2 insertions(+), 1 deletions(-)
August 5, 2020 8:01 AM, "Simon Ser" <contact@emersion.fr> wrote:
Next
Yes, of course! I think it'll involve adding a MessageID field to
OutgoingMessage. Feel free to ask questions if you have some!
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~emersion/alps-dev/patches/11854/mbox | git am -3
Learn more about email & git

[PATCH v2] Set Message-Id header Export this patch

---
> go-message already has a helper to generate Message-Id header fields

Oh woops, silly me! Let me know if this patch looks good, it overwrites
the Message-Id header as requested!

The only thing I noticed is that the header is defined as "Message-Id"
rather than "Message-ID", not a big deal but I don't think it's 100%
RFC compliant as is.
 plugins/base/smtp.go | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/plugins/base/smtp.go b/plugins/base/smtp.go
index 19c9e0b..de4753f 100644
--- a/plugins/base/smtp.go
+++ b/plugins/base/smtp.go
@@ -138,7 +138,8 @@ func (msg *OutgoingMessage) WriteTo(w io.Writer) error {
	if msg.InReplyTo != "" {
		h.Set("In-Reply-To", msg.InReplyTo)
	}
	// TODO: set Message-ID

    h.Set("Message-Id", mail.GenerateMessageID())

	mw, err := mail.CreateWriter(w, h)
	if err != nil {
-- 
2.28.0
Thanks! Pushed with a minor edit to change indentation to tabs instead
of spaces.