1. 程式人生 > >nodeJs的nodemailer發郵件報錯hostname/IP doesn't match certificate's altnames怎麼解決?

nodeJs的nodemailer發郵件報錯hostname/IP doesn't match certificate's altnames怎麼解決?

今天在開發過程中碰到一個問題,即使用node傳送郵件時報錯hostname/IP doesn't match certificate's altnames,在網上查瞭解決辦法有兩個,

  1. rejectUnauthorized: false, 【沒有解決】

  2. process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0'; 【不好嘗試】

  3. 最後解決,加

    {
         url:'xxx',
         ssl:{
             rejectUnauthorized: false
         }
     }





    轉載自http://money.sixstone.top