diff --git a/src/lib/email.ts b/src/lib/email.ts index 5c2429b..45b596e 100644 --- a/src/lib/email.ts +++ b/src/lib/email.ts @@ -179,36 +179,74 @@ export const sendMessageNotification = async ( senderEmail: string, senderPhone: string | null, senderPersonnummer: string | null, + senderAddress: string | null, + senderZipCode: string | null, + senderCity: string | null, messageContent: string, actionLink: string, - actionText: string + actionText: string, + isCustomerSender: boolean = true ) => { - // Determine labels and values even if null to show clarity + // Format display values with fallbacks const phoneDisplay = senderPhone || 'Ej angivet'; const personnummerDisplay = senderPersonnummer || 'Ej angivet'; + const addressDisplay = senderAddress || 'Ej angivet'; + const zipCodeDisplay = senderZipCode || ''; + const cityDisplay = senderCity || ''; + const fullAddressDisplay = [addressDisplay, zipCodeDisplay, cityDisplay].filter(Boolean).join(', '); - const content = ` -
| Namn: | +${senderName} | +
| E-post: | +${senderEmail} | +
| Telefon: | +${phoneDisplay} | +
| Personnummer: | +${personnummerDisplay} | +
| Adress: | +${fullAddressDisplay} | +
Från: ${senderName}
-Email: ${senderEmail}
-Telefon: ${phoneDisplay}
-Personnummer: ${personnummerDisplay}
+Email: ${senderEmail}
- ${messageContent} -+ ${customerDetailsSection} + +
+
Klicka på knappen ovan för att svara direkt i portalen.