-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
34 lines (29 loc) · 893 Bytes
/
app.js
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
32
33
34
const imaps = require('imap-simple');
const express = require('express');
const bodyParser = require('body-parser');
const app = express();
app.use(bodyParser.json());
app.post('/verify', async (req, res) => {
const { email, password } = req.body;
const config = {
imap: {
user: email,
password: password,
host: 'imap-mail.outlook.com',
port: 993,
tls: true,
authTimeout: 3000
}
};
try {
const connection = await imaps.connect(config);
await connection.end();
res.json({ success: true, message: 'Doğrulama başarılı!' });
} catch (error) {
res.json({ message: 'Doğrulama başarısız!', error: error.message });
}
});
const PORT = process.env.PORT || 3000;
app.listen(PORT, () => {
console.log(`Server is running on port ${PORT}`);
});