mail.js
790 Bytes
var express = require('express');
var router = express.Router();
var nodemailer = require('nodemailer');
var smtpTransport = nodemailer.createTransport({
service: 'Gmail',
auth: {
user: 'violet3073@gmail.com',
pass: 'jiyun656000'
}
});
var mailOptions = {
from: '정지윤 <violet3073@gmail.com>',
to: 'kyung__e@naver.com',
subject: '예약 게시판 확인해주세요!',
text: '예약이 도착했습니다'
};
router.get('/', function(req, res){
smtpTransport.sendMail(mailOptions, function(error, response){
if (error){
console.log(error);
} else {
console.log("Message sent : " + response.message);
}
smtpTransport.close();
});
res.send('전송 완료');
});
module.exports = router;