-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add contact page and data stored in database (#49)
* contact page added * Add Nodemailer Feature
- Loading branch information
1 parent
18903c9
commit a9299b3
Showing
7 changed files
with
199 additions
and
1 deletion.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,11 @@ | ||
const nodemailer = require('nodemailer'); | ||
|
||
const transporter = nodemailer.createTransport({ | ||
service: 'gmail', | ||
auth: { | ||
user: process.env.EMAIL_USERNAME, | ||
pass: process.env.EMAIL_APP_PASSWORD, | ||
}, | ||
}); | ||
|
||
module.exports = transporter; |
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,10 @@ | ||
const mongoose = require('mongoose'); | ||
|
||
const ContactMessageSchema = new mongoose.Schema({ | ||
name: { type: String, required: true }, | ||
email: { type: String, required: true }, | ||
message: { type: String, required: true }, | ||
createdAt: { type: Date, default: Date.now }, | ||
}); | ||
|
||
module.exports = mongoose.model('ContactMessage', ContactMessageSchema); |
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,29 @@ | ||
<section class="contact-section"> | ||
<div class="contact-container"> | ||
<h1>Contact Us</h1> | ||
<p>If you have any questions or feedback, feel free to reach out!</p> | ||
|
||
<!-- Display success message if available --> | ||
<% if (typeof message !== 'undefined') { %> | ||
<div class="message"> | ||
<p><%= message %></p> | ||
</div> | ||
<% } %> | ||
|
||
<form action="/send-message" method="POST"> | ||
<div class="form-group"> | ||
<label for="name">Name:</label> | ||
<input type="text" id="name" name="name" required /> | ||
</div> | ||
<div class="form-group"> | ||
<label for="email">Email:</label> | ||
<input type="email" id="email" name="email" required /> | ||
</div> | ||
<div class="form-group"> | ||
<label for="message">Message:</label> | ||
<textarea id="message" name="message" rows="5" required></textarea> | ||
</div> | ||
<button type="submit" class="btn-submit">Send Message</button> | ||
</form> | ||
</div> | ||
</section> |