emersion / hydroxide

A third-party, open-source ProtonMail CardDAV, IMAP and SMTP bridge
MIT License
1.64k stars 126 forks source link

[2060] The EncToken does not match PGP message format. #213

Closed ozmutley closed 2 years ago

ozmutley commented 2 years ago

Recently (since 3rd May 2022) I have been receiving the following error messages from hydroxide when trying to send emails:

554 5.0.0 Error: transaction failed, blame it on the weather: cannot send message: [2060] The EncToken does not match PGP message format.

The email is created as a draft in ProtonMail and I am able to manually send the email from the ProtonMail web client.

I have also attached the debug log from hydroxide and the payload when manually sending the email from the web client hydroxide.log protonmail_payload.txt

NidhoogJX commented 2 years ago

I encountered the same problem. The server encountered an error when sending mail,The error information is as follows:request failed: POST https://old.protonmail.com/api/messages/C_Cg3g9GQzpOf4Ikfyofux37w0NcgkeBl38JMKsMvFXfyN4len3iNL7gjIKfjziPVXS27PBryC-SoAHfcCg-wA==: [2060] The EncToken does not match PGP message format.

NidhoogJX commented 2 years ago

Is this project still being maintained

yulqen commented 2 years ago

I am receiving the same error message when trying to send an email. No issues with the protonmail webmail interface. Have tried running with -debug. Not obvious to me what value EncToken is supposed to have here.

{"ID":"QNYmcBybiB1yQyNLg78bp_bqm6bbIbfPmIVztt-kaCO4V2H17kLGG_rJrsWiBrX4QGunvbBY_Qd3mz1GfiVXA==",
"ExpirationTime":0,
"Packages":[{"Type":4,
"Addresses":{"anyone@gmail.com":{"Type":4,"BodyKeyPacket":"",
"AttachmentKeyPackets":null,"Signature":0,"PasswordHint":"",
"Auth":null,"Token":"","EncToken":""}},
"MIMEType":"text/plain","Body":"0sAtAQ053Jtbp9gA/NJRuCNWZUeXHJeRDVQ5aABBuD+1/PoJPAZBYjsv9rD5JXDGuVHhAvYREdutym2drxxesHGltHeShyLgLaOp3lMkNtq0xgfYUleAX0wFwEwOGe2iwUl+N9CR4r/p2nI9QU74SIssLK4VYgEZtH0axek8Fkd8n6FNlVRLRuHcSIwzEaVmIfo4mswmXX9Wju6+Th1X/GMkzCZxHSyWbV8Q/QsqnHcqNLOXtYwOVZG1tPpbgL2nTJHJt8fYYn1YAnxwyS4gGxMkQeY2s+8r6aZkphdJAse8uK1IMXHlmCjtJ5",
"BodyKey":{"Algorithm":"aes256","Key":"EG8UKRD/iADjksjAdx62d+LgrDHPZhj1BJmYo="}}]}
dvalter commented 2 years ago

Looks like EncToken is never set in current code so it's serialized as an empty string. Likely it is no longer a valid value since a recent PM server update. Removing EncToken completely fixes this issue for me for both mail.protonmail.com and old.protonmail.com endpoints

emersion commented 2 years ago

Cool, then we should add json:",omitempty" to that field.

yulqen commented 2 years ago

I have tested and it fixes the problem. Would you like a PR?

emersion commented 2 years ago

Yes please!

ozmutley commented 2 years ago

Thanks for the speedy resolution. The new release solves the problem for me.