Skip to content

Commit 3e7d409

Browse files
committed
updated email text and subject
1 parent 281c02e commit 3e7d409

4 files changed

Lines changed: 93 additions & 28 deletions

File tree

backend/src/controller/user.controller.ts

Lines changed: 52 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,29 @@ export const register = async (request: Request, response: any) => {
3131
const job = {
3232
type: "sendEmail",
3333
to: email,
34-
subject: 'Wellcome back',
34+
subject: `👋 Welcome Back ${existingUsers.name}`,
35+
text:`Hi there 👋
36+
37+
${existingUsers.name} Welcome back to ByteBox! ☁️
38+
We missed you 😊
39+
40+
Your secure cloud space is still here, ready and waiting for you. Jump back in to access, upload, and share your files anytime, anywhere.
41+
42+
✨ Here’s what you can do right now:
43+
📂 View your saved files
44+
⬆️ Upload new documents, photos, or videos
45+
🔗 Share files with secure links
46+
🔐 Enjoy fast & safe storage
47+
48+
🚀 Continue where you left off:
49+
👉 Log in to your ByteBox account
50+
51+
If you need any help or have questions, just reply to this email — we’re always happy to assist 💬
52+
53+
Glad to have you back!
54+
Team ByteBox
55+
Secure • Fast • Simple ☁️`
3556
};
36-
console.log('job added')
3757
await redis.lpush("jobs", JSON.stringify(job))
3858
return response.status(202).json({
3959
message: "email already exists, Please Sign-in",
@@ -55,7 +75,6 @@ export const register = async (request: Request, response: any) => {
5575
upsert: false,
5676
});
5777
if (error) {
58-
console.log(uniqueFilename,process.env.SUPABASE_BUCKET)
5978
response.status(500).json({
6079
message: "Server error",
6180
success: false,
@@ -87,6 +106,36 @@ export const register = async (request: Request, response: any) => {
87106
success: false,
88107
})}
89108
const token = await user.generateToken()
109+
const job = {
110+
type: "sendEmail",
111+
to: email,
112+
subject: '🎉 Your ByteBox is Ready!',
113+
text:`Hi there 👋
114+
115+
Welcome to ByteBox – your personal space in the cloud ☁️
116+
117+
We’re excited to have you onboard! 🎉
118+
Your account is now ready, and you can start uploading, organizing, and sharing files securely anytime, anywhere.
119+
120+
🗂️ What you can do with ByteBox:
121+
• Upload photos, videos, documents & more
122+
• Access files from any device 📱💻
123+
• Share files instantly with secure links 🔐
124+
• Fast, smooth & safe storage experience
125+
126+
✨ Get started now:
127+
👉 Log in and upload your first file
128+
129+
If you ever need help, just reply to this email — we’re always happy to support you 😊
130+
131+
Thanks for choosing ByteBox
132+
Let’s store smarter, together 🚀
133+
134+
Best regards,
135+
Team ByteBox
136+
☁️ Secure • Fast • Simple`
137+
};
138+
await redis.lpush("jobs", JSON.stringify(job))
90139
return response.status(201).json({
91140
message: "User created successfully",
92141
user,

backend/src/worker.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ async function startWorker() {
2222
async function processJob(job: any) {
2323
console.log("Processing:", job);
2424
const jobs = {
25-
to: job.to
25+
to: job.to,
26+
subject: job.subject,
27+
text: job.text
2628
}
2729
try {
2830
console.log("Sending email...");

emailer/package-lock.json

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

emailer/src/worker.ts

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ const transporter = nodemailer.createTransport({
1515
},
1616
});
1717

18-
async function sendEmail(to: string) {
18+
async function sendEmail(to: string, subject: string, text: string) {
1919
try {
2020
await transporter.sendMail({
2121
from: process.env.EMAIL_USER,
2222
to,
23-
subject: "Test",
24-
text: "Hello! 👋🏻",
23+
subject,
24+
text,
2525
});
2626
return 1
2727
} catch (error) {
@@ -31,13 +31,12 @@ async function sendEmail(to: string) {
3131
}
3232

3333
app.post('/send', async function(req:Request, res:Response){
34-
console.log(req.body)
35-
const {to} = req.body
36-
if(!to) return res.status(400).json({
34+
const {to, text, subject} = req.body
35+
if(!to || !text || !subject) return res.status(400).json({
3736
message: "not sent",
3837
success: false
3938
})
40-
const response = await sendEmail(to)
39+
const response = await sendEmail(to,text,subject)
4140
if(response===0) return res.status(403).json({
4241
message: "not sent",
4342
success: false
@@ -47,7 +46,7 @@ app.post('/send', async function(req:Request, res:Response){
4746
success: true
4847
})
4948
})
50-
app.get('/api/keep-warm',(req,res)=>{
49+
app.get('/',(req:Request, res:Response)=>{
5150
res.status(200).json({ warm: true });
5251
});
5352

0 commit comments

Comments
 (0)