Skip to content

Commit b35b70b

Browse files
committed
Update source files to new version
1 parent fff4601 commit b35b70b

File tree

8 files changed

+283
-163
lines changed

8 files changed

+283
-163
lines changed

package-lock.json

+10-21
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,11 @@
1616
"react-router-dom": "^6.20.0",
1717
"react-markdown": "^8.0.7",
1818
"react-hot-toast": "^2.4.1",
19-
"uuid": "^9.0.1"
19+
"@emailjs/browser": "^3.11.0"
2020
},
2121
"devDependencies": {
2222
"@types/react": "^18.2.37",
2323
"@types/react-dom": "^18.2.15",
24-
"@types/uuid": "^9.0.7",
2524
"@typescript-eslint/eslint-plugin": "^6.10.0",
2625
"@typescript-eslint/parser": "^6.10.0",
2726
"@vitejs/plugin-react": "^4.2.0",

server.js

+69
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
import express from "express";
2+
import bodyParser from "body-parser";
3+
import cors from "cors";
4+
import { exec } from "child_process";
5+
6+
const app = express();
7+
const PORT = 3000;
8+
9+
app.use(cors());
10+
app.use(bodyParser.json());
11+
12+
app.post("/api/send-email", (req, res) => {
13+
const { formData } = req.body;
14+
15+
if (!formData) {
16+
return res.status(400).json({ error: "Form data is required." });
17+
}
18+
19+
// Format the email content
20+
const emailBody = `
21+
22+
23+
Subject: Request Access Form Submission
24+
25+
Personal Information:
26+
Name: ${formData.name}
27+
Email: ${formData.email}
28+
Phone: ${formData.phone}
29+
30+
Professional Information:
31+
Company Name: ${formData.companyName}
32+
Job Title: ${formData.jobTitle}
33+
Industry: ${formData.industry}
34+
Company Size: ${formData.companySize}
35+
Country: ${formData.country}
36+
37+
Areas of Interest:
38+
- Document Management: ${formData.interests.documentManagement ? 'Yes' : 'No'}
39+
- Workflow Automation: ${formData.interests.workflowAutomation ? 'Yes' : 'No'}
40+
- AI Content Analysis: ${formData.interests.aiContentAnalysis ? 'Yes' : 'No'}
41+
- Collaboration Tools: ${formData.interests.collaborationTools ? 'Yes' : 'No'}
42+
43+
Additional Information:
44+
Communication Preference: ${formData.communicationPreference}
45+
Timeframe: ${formData.timeframe}
46+
Source: ${formData.source}
47+
Marketing Consent: ${formData.marketingConsent ? 'Yes' : 'No'}
48+
49+
Comments:
50+
${formData.comments}
51+
52+
Submission Time: ${new Date().toISOString()}
53+
`;
54+
55+
// Send email using msmtp
56+
exec(`echo "${emailBody}" | msmtp -t`, (error, stdout, stderr) => {
57+
if (error) {
58+
console.error("Error sending email:", stderr);
59+
return res.status(500).json({ error: "Failed to send the email." });
60+
}
61+
62+
console.log("Email sent successfully:", stdout);
63+
res.status(200).json({ message: "Email sent successfully." });
64+
});
65+
});
66+
67+
app.listen(PORT, () => {
68+
console.log(`Server is running on http://localhost:${PORT}`);
69+
});

src/config/emailjs.ts

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import type { EmailJSConfig } from '../types/email';
2+
3+
export const emailConfig: EmailJSConfig = {
4+
serviceId: 'service_6ui56kc',
5+
templateId: 'template_mmdcch9',
6+
publicKey: 'pUWYeCoFd5cnzH6t2'
7+
};

0 commit comments

Comments
 (0)