Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
Tags
- docker-compose
- function
- Foreign Key
- react native
- list
- Interface
- ReactNative
- Service
- class component
- MINUS
- Filter
- map
- vuex
- enum
- animation
- Generic
- CLASS
- union
- AWS
- lifecycle
- docker
- Swift
- collection
- mongoose
- Kotlin
- LiveData
- recyclerview
- elementAt
- 생명주기
- ConstraintLayout
Archives
- Today
- Total
개발 일기
Node Mailer 란? 본문
Node Mailer란 Node.js 환경에서 email을 보여주는 모듈입니다.
많은 메일을 보낼경우에는 AWS (SES)를 사용하거나 했는데 간단한 메일을 보낼 때에는 이런 모듈을 사용하는것이 더 편리한거 같습니다.
설치 :)
npm install --save nodemailer
사용 :)
import * as nodemailer from "nodemailer";
class Mail {
constructor(to,subject,message) {
this.to = to
this.subject = subject
this.message = message
}
sendMail() {
let mailOptions = {
from: process.env.EMAIL_ID,
to: this.to,
subject: this.subject,
html: this.message
};
const transporter = nodemailer.createTransport({
service: 'gmail',
host:"smtp.gmail.com",
port:587,
secure: false,
auth: {
user: process.env.EMAIL_ID,
pass: process.env.EMAIL_PASSWORD
},
tls: { rejectUnauthorized: false }
});
return transporter.sendMail(mailOptions);
}
}
export default Mail;
'서버 > Node.js' 카테고리의 다른 글
bcrypt ? (0) | 2020.04.15 |
---|---|
Node js 보안 - (1) (0) | 2020.04.11 |
body-parser (0) | 2020.03.27 |
Sharp ( 이미지 resize ) (0) | 2020.03.26 |
express-validator ? (0) | 2020.03.19 |
Comments