Skip to content

Commit 5793670

Browse files
committed
fix: production bug for resolving path.
1 parent 874e071 commit 5793670

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

src/app/api/referral/route.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { NextRequest, NextResponse } from "next/server";
22
import prisma from "@/database/db";
33
import nodemailer from "nodemailer";
4+
import path from "path";
45

56
export async function POST(req: NextRequest) {
67
try {
@@ -77,13 +78,14 @@ const transport = nodemailer.createTransport({
7778

7879
async function sendEmail(prospects: any, ref: any, member: any) {
7980
let emailsSent = true;
81+
const emailImgPath = path.join(process.cwd(), "public", "assets", "paso-coop.jpeg");
82+
8083
for (const prospect of prospects) {
8184
// console.log(prospect.prospect_email);
8285
const mail = {
8386
from: process.env.FROM_EMAIL,
8487
to: prospect.prospect_email,
8588
subject: "You've Been Invited!",
86-
text: `Hello! -nodemailer\n`,
8789
html: `<div style="width: 100%; max-width: 600px; margin: 0 auto; font-family: Arial, sans-serif; line-height: 1.6; color: #333;">
8890
8991
@@ -134,7 +136,7 @@ async function sendEmail(prospects: any, ref: any, member: any) {
134136
attachments: [
135137
{
136138
filename: "paso-coop.jpeg", // Name of the file as it will appear in the email
137-
path: "public/assets/paso-coop.jpeg", // Path relative to your project root
139+
path: emailImgPath, // Path relative to your project root
138140
cid: "pasoLogo", // Content ID referenced in the HTML img src
139141
},
140142
],

src/app/layout.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@ import "./globals.css";
33

44
//! Update metadata to match your project
55
export const metadata: Metadata = {
6-
title: "Create Next App",
7-
description: "Generated by create next app",
6+
title: "Paso Robles Food Co-op Referral Program",
7+
description:
8+
"Join the Paso Robles Food Co-op and help grow our community through this referral program. Built by Hack4Impact at Cal Poly!",
89
};
910

1011
export default function RootLayout({ children }: { children: React.ReactNode }) {

0 commit comments

Comments
 (0)