-
Notifications
You must be signed in to change notification settings - Fork 5
/
main.js
76 lines (68 loc) · 1.91 KB
/
main.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
// This Website Created by ZaaDev
// Dont Forget to follow my instagram
// https://instagram.com/zaadevofc
// https://github.com/zaadevofc
// Happy to use :)
var express = require('express');
var nodemailer = require('nodemailer');
var axios = require('axios').default;
var router = express.Router();
const sendMails = (frm, t, s, txt, req, res) => new Promise((resolve, reject) => {
var mailOpt = nodemailer.createTransport({
service: 'gmail',
auth: { // How to use see on https://github.com/zaadev/anonymous-mail/readme.md
user: 'your_mail@eek.com', // Input your mail required!
pass: 'your_password' // Input your password required!
}
});
var setOpt = {
from: `"${frm}" <zaadev@hack.com>`,
to: `${t}`,
subject: `${s}`,
html: `${txt}`
};
mailOpt.sendMail(setOpt, (err, info) => {
if (err) {
sd = 'System error <h1 class="animate-pulse">❌</h1>'
tl = 'Failed send email ❌'
} else {
sd = 'Send success <h1 class="animate-pulse">✅</h1>'
tl = 'Succes send email ✅'
}
resolve({sd, tl})
});
});
router.get('/', function (req, res, next) {
res.render('index', {
title: 'Send Email Anonymous',
my_url: "https://hack-mail.vercel.app",
desc: "Mau ngirim email ke orang tanpa ketauan? Atau mau ngerjain pacar? Hehe :)",
author: "ZaaDev"
});
});
router.post('/send', function (req, res) {
const {
subject,
sendto,
email,
message
} = req.body
f = email,
t = sendto,
s = subject,
txt = message
sendMails(f, t, s, txt, req, res)
.then((ress) => {
res.render('msg', {
title: ress.tl,
my_url: "https://hack-mail.vercel.app",
desc: "Mau ngirim email ke orang tanpa ketauan? Atau mau ngerjain pacar? Hehe :)",
author: "ZaaDev",
msgInfo: ress.sd
});
})
})
router.get('*', function (req, res) {
res.status(404).render('error')
})
module.exports = router;