-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
98 lines (82 loc) · 2.2 KB
/
index.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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
require('dotenv').config()
const nodemailer = require('nodemailer')
const ethers = require('ethers')
const axios = require('axios')
// curently unused but would be nice to get the email associated with an ENS name or 0x.. account.
async function getAddress(){
const rpc = "https://eth-mainnet.alchemyapi.io/v2/" + process.env.ALCHEMY_KEY
const provider = ethers.getDefaultProvider(rpc)
const address = await provider.resolveName('idecentralize.eth');
console.log('ACCOUNT : ',address)
const name = await provider.lookupAddress(address);
console.log('NAME : ',name)
}
// get ENS record for email
//getAddress()
const to = '[email protected]'
const message = "It might be a little anoying while i'm running test"
const subject = "News from the MadeInDreams Organization"
const html = `
<style>
.signature-style{
position:abolute;
bottom:0px;
text-align:center;
width:100%;
color: #cccccc;
}
.logo{
height:50px;
}
a{
color:#ba277f;
text-decoration: none;
}
h1{
text-align:center;
border-bottom: 1px solid #ba277f;
}
</style>
<h1>News from the MadeInDreams Organization</h1>
<p>${message}</p>
<div class="moz-signature"><br>
<div class="signature-style"> <img class="logo"
src="https://madeindreams.org/logo.png" alt="Our Logo"> <br>
<a href="mailto:[email protected]">Ian Decentralize</a> <br>
Blockchain Developer<br>
<a href="https://madeindreams.org" moz-do-not-send="true">MadeInDreams.org</a></div>
</div>
`
var transporter = nodemailer.createTransport({
host: '127.0.0.1',
port:1025,
auth: {
user: process.env.EMAIL,
pass: process.env.PASSWORD
},
tls: {
rejectUnauthorized: false
}
});
// we can send email in loops to every address provided
var mailOptions = {
from: process.env.EMAIL ,
to: to,
subject: subject,
html: html
};
transporter.sendMail(mailOptions, function(error, info){
if (error) {
console.log(error);
} else {
console.log('Email sent: ' + info.response);
}
});
axios.post(process.env.SLACK_HOOK, {
text: message,
})
.then((response) => {
console.log(response);
}, (error) => {
console.log(error);
});