hydroxide icon indicating copy to clipboard operation
hydroxide copied to clipboard

Post request failed upon saving drafts with Thunderbird

Open Spoons opened this issue 3 years ago • 8 comments

Hey, this is a great project and I appreciate the work that has been put into it.

When Thunderbird attempts to save a message into the drafts folder, I observe the following output:

2021/05/02 21:28:24 CardDAV server listening on 127.0.0.1:3657
2021/05/02 21:28:24 IMAP server listening on 127.0.0.1:1143
2021/05/02 21:28:24 SMTP server listening on 127.0.0.1:1025
2021/05/02 21:28:37 User "username" logged in via IMAP
2021/05/02 21:28:37 Synchronizing mailbox Drafts...
2021/05/02 21:28:38 Synchronizing mailbox Drafts: done.
2021/05/02 21:28:38 request failed: POST https://mail.protonmail.com/api/messages: [2000] The Sender is required

I may be misunderstanding the intention of the output but the From and To fields are selected/filled respectively.

Spoons avatar May 03 '21 01:05 Spoons

Yup, this is a hydroxide bug.

emersion avatar May 03 '21 07:05 emersion

Is there an easy way to fix it?

streaps avatar Sep 02 '21 10:09 streaps

having the same issue in Claws

faithanalog avatar Oct 25 '21 22:10 faithanalog

The problem seems to be that the message that is submitted in the POST request to the /messages endpoint has "Sender" set to null.

The problem appears to be in smtp/smtp.go in the function SendMail. Lines 65 onwards are where the MIME headers are parsed to generate the Sender field. The message is defined on line 120. I don't know enough Go to submit a patch but perhaps this will be useful for a fellow user.

as2875 avatar Dec 27 '21 20:12 as2875

I think I found the problem. It's not actually in smtp/smtp.go but in imap/message.go on line 426.

The message is getting created without defining a sender:

msg := &protonmail.Message{
	ToList:    protonmailAddressList(toList),
	CCList:    protonmailAddressList(ccList),
	BCCList:   protonmailAddressList(bccList),
	Subject:   subject,
	Header:    formatHeader(mr.Header),
	AddressID: fromAddr.ID,
}

so I think it supposed to be something like this: (fromAddrStr was defined earlier in the function, it's the same as fromList[0].Address)

msg := &protonmail.Message{
	ToList:    protonmailAddressList(toList),
	CCList:    protonmailAddressList(ccList),
	BCCList:   protonmailAddressList(bccList),
	Subject:   subject,
	Header:    formatHeader(mr.Header),
	AddressID: fromAddr.ID,
	Sender: &protonmail.MessageAddress{
		Address: fromAddrStr,
		Name:    fromList[0].Name,
	},
}

This seemed to work for me... it successfully creates a draft of the message you're writing... except it doesn't seem to update the draft once it's created, rather it creates a new draft every time. I have no idea how to fix that. (I probably could figure it out if I spend more time on it)

Hopefully this is helpful to someone now that 2 years have passed since the last post on this thread...

Albator11 avatar May 23 '23 03:05 Albator11

The issue is still relevant in version 0.2.27

Tommimon avatar Feb 23 '24 14:02 Tommimon

The issue is still relevant in version 0.2.27

Yeah... sadly it seems this project hasn't been getting much attention... I'd be tempted to help out more and create some pull requests &c. but it seems that it's almost a dead project? I sure hope not though...

Albator11 avatar Feb 23 '24 16:02 Albator11

It's in maintenance mode. I only use the SMTP part of this project, and I try to review PRs that come in, but it's not on the top of my priority list.

emersion avatar Feb 23 '24 17:02 emersion