-
Notifications
You must be signed in to change notification settings - Fork 214
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into sign-up-fix
- Loading branch information
Showing
14 changed files
with
1,002 additions
and
545 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
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
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
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
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,33 @@ | ||
const nodemailer = require("nodemailer"); | ||
|
||
async function SendEmailController(req, resp) { | ||
const transporter = nodemailer.createTransport({ | ||
service: "gmail", | ||
auth: { | ||
user: "[email protected]", // youe email | ||
pass: "password", // your password | ||
}, | ||
}); | ||
|
||
const mailOptions = { | ||
from: "[email protected]", | ||
to: "[email protected]", // email where you want to receive the message | ||
subject: "New From Collect your GamingTools", | ||
text: ` | ||
Name: ${req.body.Name} | ||
Email: ${req.body.Email} | ||
Message: ${req.body.Message}`, | ||
}; | ||
|
||
transporter.sendMail(mailOptions, (error, info) => { | ||
if (error) { | ||
console.log("Error sending email: " + error); | ||
resp.status(500).send("Error sending email"); | ||
} else { | ||
console.log("Email sent: " + info.response); | ||
resp.status(200).send("Form data sent successfully"); | ||
} | ||
}); | ||
} | ||
|
||
module.exports = { SendEmailController }; |
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
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,8 @@ | ||
const express = require("express"); | ||
const emailRouter = express.Router(); | ||
|
||
const { SendEmailController } = require("../controller/EmailController"); | ||
|
||
emailRouter.post("/SendEmail", SendEmailController); | ||
|
||
module.exports = emailRouter; |
Oops, something went wrong.