eleith / emailjs

html emails and attachments to any smtp server with nodejs
MIT License
2.19k stars 230 forks source link

feat: return promise from Message read #297

Closed CarsonF closed 3 years ago

CarsonF commented 3 years ago

I want to use this library to build mime messages that I'll send to AWS SES directly. This makes it easier to get the built message back.

CarsonF commented 3 years ago

How's it a breaking change? Both work:

message.read((err, data) => { ... });
await message.read();
zackschuster commented 3 years ago

Because it modifies the API signature. Technically this could be resolved by only returning a promise if callback == null — since that's an overload, not a modification — but, as mentioned before, the pattern established in SMTPClient demands we go with a separate readAsync method.

zackschuster commented 3 years ago

Thank you! 😄

zackschuster commented 3 years ago

@CarsonF this (as well as your other PR) should be live as of v3.6.0 😄

CarsonF commented 3 years ago

Already all over it. Thanks @zackschuster!!