Skip to content
Snippets Groups Projects
Commit bd6a10d8 authored by LeeYongJae's avatar LeeYongJae
Browse files

Merge branch 'nodemailer완성' into 'master'

nodemailer완성

See merge request !12
parents 453c466f 53918c0c
No related branches found
No related tags found
1 merge request!12nodemailer완성
**/node_modules
\ No newline at end of file
**/node_modules
**/node_modules
**/frontend/package-lock.json
**/frontend/package.json
......@@ -8,6 +8,7 @@ var logger = require("morgan");
var bookRouter = require("./routes/books");
var loginRouter = require("./routes/login");
var emailRouter = require("./routes/emails");
var app = express();
......@@ -34,6 +35,7 @@ app.use(express.static(path.join(__dirname, "public")));
app.use("/api/books", bookRouter);
app.use("/api/login", loginRouter);
app.use("/api/emails", emailRouter);
// catch 404 and forward to error handler
app.use(function(req, res, next) {
......
......@@ -673,6 +673,11 @@
"resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.2.tgz",
"integrity": "sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw=="
},
"nodemailer": {
"version": "6.4.0",
"resolved": "https://registry.npmjs.org/nodemailer/-/nodemailer-6.4.0.tgz",
"integrity": "sha512-UBqPOfQGD1cM3HnjhuQe+0u3DWx47WWK7lBjG5UtPnGOysr7oDK5lNCzcjK6zzeBSdTk4m1tGx1xNbWFZQmMNA=="
},
"object-assign": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
......
......@@ -14,6 +14,7 @@
"http-errors": "~1.6.3",
"mongoose": "^5.7.12",
"morgan": "~1.9.1",
"nodemailer": "^6.4.0",
"pug": "2.0.0-beta11"
}
}
const express = require('express');
const nodemailer = require('nodemailer');
const router = express.Router();
router.get("", function(req, res, next){
let email = "hj950000@ajou.ac.kr"
let transporter = nodemailer.createTransport({
service: 'gmail',
auth: {
user: 'majorbook202@gmail.com', // gmail 계정 아이디를 입력
pass: 'dnjfdydlf' // gmail 계정의 비밀번호를 입력
}
});
let mailOptions = {
from: 'majorbook202@gmail.com', // 발송 메일 주소 (위에서 작성한 gmail 계정 아이디)
to: "hj950000@ajou.ac.kr", // 수신 메일 주소
subject: 'MajorBook구매요청이 들어왔습니다.', // 제목
text: '올리신 책 ~~에 대한 구매요청이 도착했습니다. 해당 구매자의 전화번호는 ~~입니다.' // 내용
};
transporter.sendMail(mailOptions, function(error, info){
if (error) {
console.log(error);
}
else {
console.log('Email sent: ' + info.response);
}
});
})
module.exports = router;
\ No newline at end of file
......@@ -69,7 +69,7 @@
<!-- =============서포터즈 submit 양식 ================== -->
<div>
<md-dialog :md-active.sync="active" style="width : 500px; height: 1000px ">
<md-dialog-title>서포터즈 신청</md-dialog-title>
<md-dialog-title>판매도서 등록</md-dialog-title>
<md-field class="select">
<label>책제목</label>
<md-input v-model="submit.title"></md-input>
......
......@@ -13,14 +13,25 @@
<script>
import Hotlist from "./home_hotlist/HotList";
export default {
created() {
this
.$http
.get('/api/emails')
.then(response => {
console.log("Sending Success")
})
},
data() {
return {};
},
components: {
Hotlist
},
methods: {}
methods: {
}
};
</script>
......
......@@ -20,6 +20,70 @@
</md-button>
</md-list-item>
<md-divider></md-divider>
<md-list-item>
<md-button class="md-icon-button md-raised" style="color:#1DDB16;backgroundColor:#1DDB16">
<img src="../../assets/book-open-flat.png" />
</md-button>
<div class="md-list-item-text">
<span>&nbsp;&nbsp;책 제목</span>
<span>&nbsp;&nbsp;구매 대기중</span>
</div>
<md-button class="md-icon-button md-raised md-accent">
<img src="../../assets/x-512.png" />
</md-button>
<md-button class="md-icon-button md-raised md-primary">
<img src="../../assets/check-icon.png" />
</md-button>
</md-list-item>
<md-divider></md-divider>
<md-list-item>
<md-button class="md-icon-button md-raised" style="color:#1DDB16;backgroundColor:#1DDB16">
<img src="../../assets/book-open-flat.png" />
</md-button>
<div class="md-list-item-text">
<span>&nbsp;&nbsp;책 제목</span>
<span>&nbsp;&nbsp;구매 대기중</span>
</div>
<md-button class="md-icon-button md-raised md-accent">
<img src="../../assets/x-512.png" />
</md-button>
<md-button class="md-icon-button md-raised md-primary">
<img src="../../assets/check-icon.png" />
</md-button>
</md-list-item>
<md-divider></md-divider>
<md-list-item>
<md-button class="md-icon-button md-raised" style="color:#1DDB16;backgroundColor:#1DDB16">
<img src="../../assets/book-open-flat.png" />
</md-button>
<div class="md-list-item-text">
<span>&nbsp;&nbsp;책 제목</span>
<span>&nbsp;&nbsp;구매 대기중</span>
</div>
<md-button class="md-icon-button md-raised md-accent">
<img src="../../assets/x-512.png" />
</md-button>
<md-button class="md-icon-button md-raised md-primary">
<img src="../../assets/check-icon.png" />
</md-button>
</md-list-item>
<md-divider></md-divider>
<md-list-item>
<md-button class="md-icon-button md-raised" style="color:#1DDB16;backgroundColor:#1DDB16">
<img src="../../assets/book-open-flat.png" />
</md-button>
<div class="md-list-item-text">
<span>&nbsp;&nbsp;책 제목</span>
<span>&nbsp;&nbsp;구매 대기중</span>
</div>
<md-button class="md-icon-button md-raised md-accent">
<img src="../../assets/x-512.png" />
</md-button>
<md-button class="md-icon-button md-raised md-primary">
<img src="../../assets/check-icon.png" />
</md-button>
</md-list-item>
<md-divider></md-divider>
</md-list>
</div>
</template>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment