How to send encrypted/TLS emails with NodeJS from localhost using send mail











up vote
0
down vote

favorite












I want to be able to send emails from my local domain without using gmail or other SMTP servers.



I'm currently using SendMail:



const sendmail = require('sendmail') ({
logger: {
debug: console.log,
info: console.info,
warn: console.warn,
error: console.error
},
dkim: {
privateKey: dkimPrivateKey,
keySelector: 'default'
},
});


sendmail({
from: 'foo@mydomain.com',
to: 'mygmail@gmail.com',
subject: 'test sendmail',
html: 'Mail of test sendmail ',
}, function(err, reply) {
console.log(err && err.stack);
console.dir(reply);
});


and this DOES work, BUT when I receive the email in my Gmail account, and I view the message information, Google is marking this as 'security: No encryption'



From what I understand I need to use TLS to create a 'secure' connection. I already have a certificate and keys from LetsEncrypt and my domain is already using HTTPS. How do I encrypt/use TLS my outgoing emails?



Or is there a better package for this? I've tried using NodeMailer and my emails only get added to a 'queue' and never sent.










share|improve this question




























    up vote
    0
    down vote

    favorite












    I want to be able to send emails from my local domain without using gmail or other SMTP servers.



    I'm currently using SendMail:



    const sendmail = require('sendmail') ({
    logger: {
    debug: console.log,
    info: console.info,
    warn: console.warn,
    error: console.error
    },
    dkim: {
    privateKey: dkimPrivateKey,
    keySelector: 'default'
    },
    });


    sendmail({
    from: 'foo@mydomain.com',
    to: 'mygmail@gmail.com',
    subject: 'test sendmail',
    html: 'Mail of test sendmail ',
    }, function(err, reply) {
    console.log(err && err.stack);
    console.dir(reply);
    });


    and this DOES work, BUT when I receive the email in my Gmail account, and I view the message information, Google is marking this as 'security: No encryption'



    From what I understand I need to use TLS to create a 'secure' connection. I already have a certificate and keys from LetsEncrypt and my domain is already using HTTPS. How do I encrypt/use TLS my outgoing emails?



    Or is there a better package for this? I've tried using NodeMailer and my emails only get added to a 'queue' and never sent.










    share|improve this question


























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      I want to be able to send emails from my local domain without using gmail or other SMTP servers.



      I'm currently using SendMail:



      const sendmail = require('sendmail') ({
      logger: {
      debug: console.log,
      info: console.info,
      warn: console.warn,
      error: console.error
      },
      dkim: {
      privateKey: dkimPrivateKey,
      keySelector: 'default'
      },
      });


      sendmail({
      from: 'foo@mydomain.com',
      to: 'mygmail@gmail.com',
      subject: 'test sendmail',
      html: 'Mail of test sendmail ',
      }, function(err, reply) {
      console.log(err && err.stack);
      console.dir(reply);
      });


      and this DOES work, BUT when I receive the email in my Gmail account, and I view the message information, Google is marking this as 'security: No encryption'



      From what I understand I need to use TLS to create a 'secure' connection. I already have a certificate and keys from LetsEncrypt and my domain is already using HTTPS. How do I encrypt/use TLS my outgoing emails?



      Or is there a better package for this? I've tried using NodeMailer and my emails only get added to a 'queue' and never sent.










      share|improve this question















      I want to be able to send emails from my local domain without using gmail or other SMTP servers.



      I'm currently using SendMail:



      const sendmail = require('sendmail') ({
      logger: {
      debug: console.log,
      info: console.info,
      warn: console.warn,
      error: console.error
      },
      dkim: {
      privateKey: dkimPrivateKey,
      keySelector: 'default'
      },
      });


      sendmail({
      from: 'foo@mydomain.com',
      to: 'mygmail@gmail.com',
      subject: 'test sendmail',
      html: 'Mail of test sendmail ',
      }, function(err, reply) {
      console.log(err && err.stack);
      console.dir(reply);
      });


      and this DOES work, BUT when I receive the email in my Gmail account, and I view the message information, Google is marking this as 'security: No encryption'



      From what I understand I need to use TLS to create a 'secure' connection. I already have a certificate and keys from LetsEncrypt and my domain is already using HTTPS. How do I encrypt/use TLS my outgoing emails?



      Or is there a better package for this? I've tried using NodeMailer and my emails only get added to a 'queue' and never sent.







      ssl smtp lets-encrypt nodemailer starttls






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 21 at 6:17

























      asked Nov 19 at 12:55









      orangeMint

      451323




      451323
























          1 Answer
          1






          active

          oldest

          votes

















          up vote
          0
          down vote













          The TLS encryption doesn't have to do anything with the HTTP certificates. This works with STARTTLS. Did you found any reason for queuing in the maillog? Hope the ports are not blocked.
          You can try out this Node library: https://github.com/pepipost/pepipost-sdk-nodejs



          It does TLS encryption and works over HTTP instead of SMTP.






          share|improve this answer





















          • Never found why the email was being held in the queue, it wasn't the port. I'll check the link you sent, however, I'd like to stay with free/MIT license packages
            – orangeMint
            Nov 19 at 13:13










          • Nodemailer is definitely a good one. If you can share the /var/log/mail.log output, that will help to further debug what can be the possible root cause for the queuing.
            – Dibya Sahoo
            Nov 19 at 13:27










          • Didn't find anything in that log file... but here is more info on my NodeMailer set up that I just posted stackoverflow.com/questions/53376807/…
            – orangeMint
            Nov 19 at 14:33











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














           

          draft saved


          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53375124%2fhow-to-send-encrypted-tls-emails-with-nodejs-from-localhost-using-send-mail%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          0
          down vote













          The TLS encryption doesn't have to do anything with the HTTP certificates. This works with STARTTLS. Did you found any reason for queuing in the maillog? Hope the ports are not blocked.
          You can try out this Node library: https://github.com/pepipost/pepipost-sdk-nodejs



          It does TLS encryption and works over HTTP instead of SMTP.






          share|improve this answer





















          • Never found why the email was being held in the queue, it wasn't the port. I'll check the link you sent, however, I'd like to stay with free/MIT license packages
            – orangeMint
            Nov 19 at 13:13










          • Nodemailer is definitely a good one. If you can share the /var/log/mail.log output, that will help to further debug what can be the possible root cause for the queuing.
            – Dibya Sahoo
            Nov 19 at 13:27










          • Didn't find anything in that log file... but here is more info on my NodeMailer set up that I just posted stackoverflow.com/questions/53376807/…
            – orangeMint
            Nov 19 at 14:33















          up vote
          0
          down vote













          The TLS encryption doesn't have to do anything with the HTTP certificates. This works with STARTTLS. Did you found any reason for queuing in the maillog? Hope the ports are not blocked.
          You can try out this Node library: https://github.com/pepipost/pepipost-sdk-nodejs



          It does TLS encryption and works over HTTP instead of SMTP.






          share|improve this answer





















          • Never found why the email was being held in the queue, it wasn't the port. I'll check the link you sent, however, I'd like to stay with free/MIT license packages
            – orangeMint
            Nov 19 at 13:13










          • Nodemailer is definitely a good one. If you can share the /var/log/mail.log output, that will help to further debug what can be the possible root cause for the queuing.
            – Dibya Sahoo
            Nov 19 at 13:27










          • Didn't find anything in that log file... but here is more info on my NodeMailer set up that I just posted stackoverflow.com/questions/53376807/…
            – orangeMint
            Nov 19 at 14:33













          up vote
          0
          down vote










          up vote
          0
          down vote









          The TLS encryption doesn't have to do anything with the HTTP certificates. This works with STARTTLS. Did you found any reason for queuing in the maillog? Hope the ports are not blocked.
          You can try out this Node library: https://github.com/pepipost/pepipost-sdk-nodejs



          It does TLS encryption and works over HTTP instead of SMTP.






          share|improve this answer












          The TLS encryption doesn't have to do anything with the HTTP certificates. This works with STARTTLS. Did you found any reason for queuing in the maillog? Hope the ports are not blocked.
          You can try out this Node library: https://github.com/pepipost/pepipost-sdk-nodejs



          It does TLS encryption and works over HTTP instead of SMTP.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 19 at 13:07









          Dibya Sahoo

          389514




          389514












          • Never found why the email was being held in the queue, it wasn't the port. I'll check the link you sent, however, I'd like to stay with free/MIT license packages
            – orangeMint
            Nov 19 at 13:13










          • Nodemailer is definitely a good one. If you can share the /var/log/mail.log output, that will help to further debug what can be the possible root cause for the queuing.
            – Dibya Sahoo
            Nov 19 at 13:27










          • Didn't find anything in that log file... but here is more info on my NodeMailer set up that I just posted stackoverflow.com/questions/53376807/…
            – orangeMint
            Nov 19 at 14:33


















          • Never found why the email was being held in the queue, it wasn't the port. I'll check the link you sent, however, I'd like to stay with free/MIT license packages
            – orangeMint
            Nov 19 at 13:13










          • Nodemailer is definitely a good one. If you can share the /var/log/mail.log output, that will help to further debug what can be the possible root cause for the queuing.
            – Dibya Sahoo
            Nov 19 at 13:27










          • Didn't find anything in that log file... but here is more info on my NodeMailer set up that I just posted stackoverflow.com/questions/53376807/…
            – orangeMint
            Nov 19 at 14:33
















          Never found why the email was being held in the queue, it wasn't the port. I'll check the link you sent, however, I'd like to stay with free/MIT license packages
          – orangeMint
          Nov 19 at 13:13




          Never found why the email was being held in the queue, it wasn't the port. I'll check the link you sent, however, I'd like to stay with free/MIT license packages
          – orangeMint
          Nov 19 at 13:13












          Nodemailer is definitely a good one. If you can share the /var/log/mail.log output, that will help to further debug what can be the possible root cause for the queuing.
          – Dibya Sahoo
          Nov 19 at 13:27




          Nodemailer is definitely a good one. If you can share the /var/log/mail.log output, that will help to further debug what can be the possible root cause for the queuing.
          – Dibya Sahoo
          Nov 19 at 13:27












          Didn't find anything in that log file... but here is more info on my NodeMailer set up that I just posted stackoverflow.com/questions/53376807/…
          – orangeMint
          Nov 19 at 14:33




          Didn't find anything in that log file... but here is more info on my NodeMailer set up that I just posted stackoverflow.com/questions/53376807/…
          – orangeMint
          Nov 19 at 14:33


















           

          draft saved


          draft discarded



















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53375124%2fhow-to-send-encrypted-tls-emails-with-nodejs-from-localhost-using-send-mail%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Feedback on college project

          Futebolista

          Albești (Vaslui)