-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b0d72e0
commit 9680f22
Showing
2 changed files
with
31 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
const mailgun = require("mailgun-js"); | ||
const DOMAIN = "sandboxb488ae9cba904e73936d81f35b2ee781.mailgun.org"; | ||
const mg = mailgun({ | ||
apiKey: "d05c4d067d69c940d3dac93769dd87a2-fe066263-f6136332", | ||
domain: DOMAIN | ||
}); | ||
|
||
const sendInvite = async (newUser, email, familyName, inviteLink) => { | ||
const data = { | ||
from: "Mailgun Sandbox <[email protected]>", | ||
to: email, | ||
subject: "Welcome to BTC Family!", | ||
text: | ||
`Hi ${newUser}, | ||
You are invited to join the ${familyName} family wallet! | ||
Click here: ${inviteLink} to accept your invitation! | ||
` | ||
}; | ||
|
||
await mg.messages().send(data, function (error, body) { | ||
if (error) { | ||
console.error("Invite failed:", error) | ||
} else { | ||
console.log("Invite success:", body); | ||
} | ||
}); | ||
} | ||
|
||
export { sendInvite } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters