node-sendmail icon indicating copy to clipboard operation
node-sendmail copied to clipboard

TLS Certificates

Open markgrin opened this issue 4 years ago • 5 comments

Adding option to pass key and certificates to tls connection.

Description

Adding tls certificate solved this issue for me: https://github.com/guileen/node-sendmail/issues/76

Motivation and Context

https://github.com/guileen/node-sendmail/issues/76 - I had this problem

How Has This Been Tested?

Sent emails to gmail

Types of changes

  • [ ] Bug fix (non-breaking change which fixes an issue)
  • [x] New feature (non-breaking change which adds functionality)
  • [ ] Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • [x] My code follows the code style of this project.
  • [x] My change requires a change to the documentation.
  • [ ] I have updated the documentation accordingly.
  • [ ] I have read the CONTRIBUTING document.
  • [ ] I have added tests to cover my changes.
  • [ ] All new and existing tests passed.

markgrin avatar Aug 30 '20 15:08 markgrin

https://github.com/guileen/node-sendmail/blob/b76e5b26f967bb74f08a74281e8d0a7aaa8894ab/sendmail.js#L297-L303 Check these lines, a line is processed only if the code follows a <space> character

So if the server send 250-STARTTLS that won't be sent to response() and processed

Even I was trying to implement STARTTLS support but that would require quite some changes. Maybe we can pass another argument to the response() which would tell us whether its a <space> or dash and process line depending on that.

CCAtAlvis avatar Feb 07 '21 21:02 CCAtAlvis

Or maybe create an array with all SMTP Service Extensions available with server? This can help further if someone wants to implement/handle some other extension. 🤔

CCAtAlvis avatar Feb 07 '21 21:02 CCAtAlvis

@CCAtAlvis , thank you for feedback. I tested this PR with google email account on gmail. It had no "unencrypted" tags on emails I sent, so I guess this is more or less a working solution. If you think you can improve this PR, you are welcome to. This looks like a dead repo (last updated in 2019). I think a greater issue is finding a new maintainer for this repo.

markgrin avatar Feb 16 '21 10:02 markgrin

@markgrin Ahh yes, I overlooked the code, works perfectly fine. I am rewriting the code base for my learning, might as well open source it!

CCAtAlvis avatar Feb 17 '21 22:02 CCAtAlvis

@markgrin would it be okay for you if I fork this repo, merge your PR and publish it to npm as something like sendmail-tls?

Laurenz1606 avatar Dec 26 '21 18:12 Laurenz1606