forked from goldpriceapidb/gold-price
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmail.js
More file actions
35 lines (33 loc) · 765 Bytes
/
Copy pathmail.js
File metadata and controls
35 lines (33 loc) · 765 Bytes
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
import fetch from "node-fetch"
let data = {
service_id: "service_3my3s1s",
template_id: "template_rld89ic",
user_id: "YwEZ6_J84gx8JglSG",
template_params: {
from_name: "Meow Man",
to_name: "The Simp guy",
message: "You got a response from a user",
reply_to: "tharunoptimus@outlook.com",
copyTo: "worldisfullofmeow@gmail.com"
},
}
async function sendContent() {
try {
let request = await fetch(
"https://api.emailjs.com/api/v1.0/email/send",
{
method: "POST",
body: JSON.stringify(data),
headers: {
"Content-Type": "application/json",
},
}
)
console.log("Sent successfully")
request = await request.text()
console.log(request)
} catch (error) {
console.log(error)
console.log("Error sending mail")
}
}