Node.js ကျူတိုရီရယ်

Node.js ပင်မစာမျက်နှာ Node.js နိဒါန်း Node.js ကို စတင်လိုက်ပါ။ Node.js မော်ဂျူးများ Node.js HTTP မော်ဂျူး Node.js ဖိုင်စနစ် Node.js URL မော်ဂျူး Node.js NPM Node.js ပွဲများ Node.js ဖိုင်များ အပ်လုဒ်လုပ်ခြင်း။ Node.js အီးမေးလ်

Node.js MySQL

MySQL စတင်လိုက်ပါ။ MySQL ဒေတာဘေ့စ်ဖန်တီးပါ။ MySQL ဇယားဖန်တီးပါ။ MySQL ထဲသို့ ထည့်သွင်းပါ။ MySQL မှ ရွေးချယ်ပါ။ MySQL ဘယ်မှာလဲ။ MySQL Order By MySQL ကိုဖျက်ပါ။ MySQL Drop Table MySQL အပ်ဒိတ် MySQL ကန့်သတ်ချက် MySQL Join

Node.js MongoDB

MongoDB စတင်လိုက်ပါ။ MongoDB ဒေတာဘေ့စ်ဖန်တီးပါ။ MongoDB သည် Collection ကိုဖန်တီးပါ။ MongoDB ထည့်သွင်းပါ။ MongoDB ကိုရှာပါ။ MongoDB မေးခွန်း MongoDB အမျိုးအစား MongoDB ကိုဖျက်ပါ။ MongoDB Drop Collection MongoDB အပ်ဒိတ် MongoDB ကန့်သတ်ချက် MongoDB Join

Raspberry Pi

RasPi စတင်လိုက်ပါ။ RasPi GPIO နိဒါန်း RasPi မှိတ်တုတ်မှိတ်တုတ် LED RasPi LED နှင့် ခလုတ်နှိပ်ပါ။ RasPi စီးဆင်းနေသော LED များ RasPi WebSocket RasPi RGB LED WebSocket RasPi အစိတ်အပိုင်းများ

Node.js အ ကိုး အကား

Built-in Modules များ

Node.js အီးမေးလ်တစ်စောင်ပို့ပါ။


Nodemailer Module

Nodemailer module သည် သင့်ကွန်ပြူတာမှ အီးမေးလ်များ ပေးပို့ရန် လွယ်ကူစေသည်။

Nodemailer module ကို npm ကို အသုံးပြု၍ ဒေါင်းလုဒ်လုပ်ပြီး ထည့်သွင်းနိုင်သည်။

C:\Users\Your Name>npm install nodemailer

Nodemailer module ကို သင်ဒေါင်းလုဒ်လုပ်ပြီးနောက်၊ မည်သည့်အပလီကေးရှင်းတွင်မဆို module ထည့်သွင်းနိုင်သည်-

var nodemailer = require('nodemailer');

အီးမေးလ်တစ်စောင်ပို့ပါ။

ယခု သင့်ဆာဗာမှ အီးမေးလ်များ ပေးပို့ရန် အသင့်ဖြစ်နေပါပြီ။

အီးမေးလ်တစ်စောင်ပေးပို့ရန် သင်ရွေးချယ်ထားသော အီးမေးလ်ဝန်ဆောင်မှုပေးသူထံမှ သုံးစွဲသူအမည်နှင့် စကားဝှက်ကို အသုံးပြုပါ။ အီးမေးလ်တစ်စောင်ပေးပို့ရန် သင့် Gmail အကောင့်ကို အသုံးပြုနည်းကို ဤသင်ခန်းစာတွင် ပြသပါမည်။

ဥပမာ

var nodemailer = require('nodemailer');

var transporter = nodemailer.createTransport({
  service: 'gmail',
  auth: {
    user: '[email protected]',
    pass: 'yourpassword'
  }
});

var mailOptions = {
  from: '[email protected]',
  to: '[email protected]',
  subject: 'Sending Email using Node.js',
  text: 'That was easy!'
};

transporter.sendMail(mailOptions, function(error, info){
  if (error) {
    console.log(error);
  } else {
    console.log('Email sent: ' + info.response);
  }
});

ဒါပဲ! ယခု သင့်ဆာဗာသည် အီးမေးလ်များ ပေးပို့နိုင်ပါပြီ။



လက်ခံသူအများအပြား

လက်ခံသူ တစ်ဦးထက်ပိုသော အီးမေးလ်တစ်စောင် ပေးပို့ရန်၊ ကော်မာများဖြင့် ခြားထားသော mailOptions အရာဝတ္တု၏ "သို့" ပိုင်ဆိုင်မှုသို့ ပေါင်းထည့်ပါ-

ဥပမာ

လိပ်စာတစ်ခုထက်ပို၍ အီးမေးလ်ပို့ပါ-

var mailOptions = {
  from: 'youremail@gmail.com',
  to: '[email protected], [email protected]',
  subject: 'Sending Email using Node.js',
  text: 'That was easy!'
}

HTML ပို့ပါ။

သင့်အီးမေးလ်တွင် HTML ဖော်မတ်ထားသည့် စာသားပေးပို့ရန်၊ "စာသား" ပိုင်ဆိုင်မှုအစား "html" ပိုင်ဆိုင်မှုကို အသုံးပြုပါ-

ဥပမာ

HTML ပါဝင်သော အီးမေးလ်ကို ပို့ပါ-

var mailOptions = {
  from: 'youremail@gmail.com',
  to: '[email protected]',
  subject: 'Sending Email using Node.js',
  html: '<h1>Welcome</h1><p>That was easy!</p>'
}