Skip to content

Commit a556e5b

Browse files
committed
add share link option
1 parent 6e23d3a commit a556e5b

File tree

3 files changed

+66
-0
lines changed

3 files changed

+66
-0
lines changed

server/package-lock.json

Lines changed: 44 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

server/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"description": "",
55
"main": "index.js",
66
"dependencies": {
7+
"@sendgrid/mail": "^7.7.0",
78
"axios": "^0.26.0",
89
"bcrypt": "^5.1.0",
910
"body-parser": "^1.19.2",

server/services/smsAPI.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
const TWILIO_ACCOUNT_SID = process.env.TWILIO_ACCOUNT_SID;
22
const AUTH_TOKEN = process.env.AUTH_TOKEN;
33
const SERVICE_ID = process.env.SERVICE_ID;
4+
const sgMail = require('@sendgrid/mail')
5+
sgMail.setApiKey(process.env.SENDGRID_API_KEY)
6+
47

58
console.log("Twilio params", {
69
TWILIO_ACCOUNT_SID,
@@ -28,4 +31,22 @@ exports.verifyOTP = (phone, code) => {
2831
.then(resolve)
2932
.catch(reject);
3033
})
34+
}
35+
36+
exports.sendMail = () => {
37+
const msg = {
38+
to: '[email protected]', // Change to your recipient
39+
from: '[email protected]', // Change to your verified sender
40+
subject: 'Sending with SendGrid is Fun',
41+
text: 'and easy to do anywhere, even with Node.js',
42+
html: '<strong>and easy to do anywhere, even with Node.js</strong>',
43+
}
44+
sgMail
45+
.send(msg)
46+
.then(() => {
47+
console.log('Email sent')
48+
})
49+
.catch((error) => {
50+
console.error(error)
51+
})
3152
}

0 commit comments

Comments
 (0)