@@ -17,6 +17,7 @@ const transporter = nodemailer.createTransport({
1717
1818interface Email {
1919 to : string ;
20+ from ?: string ;
2021 subject : string ;
2122 html : string ;
2223}
@@ -25,7 +26,7 @@ async function sendEmail(email: Email): Promise<boolean> {
2526 try {
2627 await transporter . sendMail ( {
2728 ...email ,
28- from : `"Job Conciergerie" <${ process . env . SMTP_FROM_EMAIL } >` ,
29+ from : `"Job Conciergerie" <${ email . from || process . env . SMTP_FROM_EMAIL } >` ,
2930 } ) ;
3031
3132 return true ;
@@ -98,13 +99,14 @@ export async function sendEmployeeRegistrationEmail(conciergerie: Conciergerie,
9899 */
99100export async function sendEmployeeAcceptanceEmail (
100101 employee : Employee ,
101- conciergerieName : string ,
102+ conciergerie : Conciergerie ,
102103 missionsCount : number ,
103104 isAccepted : boolean ,
104105) : Promise < boolean > {
105106 const wasAccepted = employee . status === 'accepted' ;
106107 return await sendEmail ( {
107108 to : employee . email ,
109+ from : conciergerie . email ,
108110 subject : 'Information concernant votre inscription à Job Conciergerie' ,
109111 html : `
110112 <div style="font-family: Arial, sans-serif; max-width: 600px; margin: 0 auto;">
@@ -114,7 +116,7 @@ export async function sendEmployeeAcceptanceEmail(
114116 <p>Bonjour ${ employee . firstName } ${ employee . familyName } ,</p>
115117 <p>Nous vous informons que votre inscription a été ${
116118 isAccepted ? 'retenue' : wasAccepted ? 'arrêtée' : 'refusée'
117- } par la conciergerie ${ conciergerieName } .</p>
119+ } par la conciergerie ${ conciergerie . name } .</p>
118120 ${
119121 missionsCount > 0
120122 ? `<p>Vos ${ missionsCount } mission${ missionsCount > 1 ? 's' : '' } ont été annulée${
@@ -276,7 +278,7 @@ export async function sendMissionAcceptanceToEmployeeEmail(
276278 mission : Mission ,
277279 home : Home ,
278280 employee : Employee ,
279- conciergerieName : string ,
281+ conciergerie : Conciergerie ,
280282) : Promise < boolean > {
281283 // Format dates
282284 const startDate = formatDateTime ( mission . startDateTime ) ;
@@ -288,6 +290,7 @@ export async function sendMissionAcceptanceToEmployeeEmail(
288290 // Generate email content
289291 return await sendEmail ( {
290292 to : employee . email ,
293+ from : conciergerie . email ,
291294 subject : `🔔 Confirmation de mission - ${ home . title } ` ,
292295 html : `
293296 <div style="font-family: Arial, sans-serif; max-width: 600px; margin: 0 auto;">
@@ -298,7 +301,7 @@ export async function sendMissionAcceptanceToEmployeeEmail(
298301 <div style="background-color: #f5f7ff; padding: 15px; border-radius: 5px; margin: 15px 0; border: 1px solid #4F46E5;">
299302 <h3 style="margin-top: 0; color: #4F46E5;">Récapitulatif de la mission</h3>
300303 <p><strong>Bien:</strong> ${ home . title } </p>
301- <p><strong>Conciergerie:</strong> ${ conciergerieName } </p>
304+ <p><strong>Conciergerie:</strong> ${ conciergerie . name } </p>
302305 <p><strong>Date de début:</strong> ${ startDate } </p>
303306 <p><strong>Date de fin:</strong> ${ endDate } </p>
304307 <p><strong>Durée estimée:</strong> ${ hours } </p>
@@ -333,7 +336,7 @@ export async function sendMissionUpdatedToEmployeeEmail(
333336 mission : Mission ,
334337 home : Home ,
335338 employee : Employee ,
336- conciergerieName : string ,
339+ conciergerie : Conciergerie ,
337340 changes : string [ ] ,
338341) : Promise < boolean > {
339342 // Format dates
@@ -346,14 +349,15 @@ export async function sendMissionUpdatedToEmployeeEmail(
346349 // Generate email content
347350 return await sendEmail ( {
348351 to : employee . email ,
352+ from : conciergerie . email ,
349353 subject : `🔄 Mise à jour de mission - ${ home . title } ` ,
350354 html : `
351355 <div style="font-family: Arial, sans-serif; max-width: 600px; margin: 0 auto;">
352356 <h2 style="color: #d97706;">Mise à jour de mission</h2>
353357 <p>Bonjour ${ employee . firstName } ,</p>
354- <p>Une mission que vous avez acceptée pour <strong>${
355- home . title
356- } </strong> a été modifiée par la conciergerie ${ conciergerieName } .</p>
358+ <p>Une mission que vous avez acceptée pour <strong>${ home . title } </strong> a été modifiée par la conciergerie ${
359+ conciergerie . name
360+ } .</p>
357361
358362 <div style="background-color: #fffbeb; padding: 15px; border-radius: 5px; margin: 15px 0; border: 1px solid #d97706;">
359363 <h3 style="margin-top: 0; color: #d97706;">Modifications apportées</h3>
@@ -365,7 +369,7 @@ export async function sendMissionUpdatedToEmployeeEmail(
365369 <div style="background-color: #f9fafb; padding: 15px; border-radius: 5px; margin: 15px 0;">
366370 <h3 style="margin-top: 0; color: #4b5563;">Détails mis à jour de la mission</h3>
367371 <p><strong>Bien:</strong> ${ home . title } </p>
368- <p><strong>Conciergerie:</strong> ${ conciergerieName } </p>
372+ <p><strong>Conciergerie:</strong> ${ conciergerie . name } </p>
369373 <p><strong>Date de début:</strong> ${ startDate } </p>
370374 <p><strong>Date de fin:</strong> ${ endDate } </p>
371375 <p><strong>Durée estimée:</strong> ${ hours } </p>
@@ -395,7 +399,7 @@ export async function sendMissionRemovedToEmployeeEmail(
395399 mission : Mission ,
396400 home : Home ,
397401 employee : Employee ,
398- conciergerieName : string ,
402+ conciergerie : Conciergerie ,
399403 type : 'deleted' | 'canceled' ,
400404) : Promise < boolean > {
401405 // Format dates
@@ -425,21 +429,22 @@ export async function sendMissionRemovedToEmployeeEmail(
425429 // Generate email content
426430 return await sendEmail ( {
427431 to : employee . email ,
432+ from : conciergerie . email ,
428433 subject : `${ config . emoji } ${ config . title } - ${ home . title } ` ,
429434 html : `
430435 <div style="font-family: Arial, sans-serif; max-width: 600px; margin: 0 auto;">
431436 <h2 style="color: ${ config . color } ;">${ config . title } </h2>
432437 <p>Bonjour ${ employee . firstName } ,</p>
433438 <p>Nous vous informons que la mission pour <strong>${ home . title } </strong> a été ${
434439 config . action
435- } par la conciergerie ${ conciergerieName } .</p>
440+ } par la conciergerie ${ conciergerie . name } .</p>
436441
437442 <div style="background-color: ${
438443 config . bgColor
439444 } ; padding: 15px; border-radius: 5px; margin: 15px 0; border: 1px solid ${ config . color } ;">
440445 <h3 style="margin-top: 0; color: ${ config . color } ;">Détails de la mission ${ config . action } </h3>
441446 <p><strong>Bien:</strong> ${ home . title } </p>
442- <p><strong>Conciergerie:</strong> ${ conciergerieName } </p>
447+ <p><strong>Conciergerie:</strong> ${ conciergerie . name } </p>
443448 <p><strong>Date de début:</strong> ${ startDate } </p>
444449 <p><strong>Date de fin:</strong> ${ endDate } </p>
445450 <p><strong>Tâches:</strong> ${ mission . tasks . join ( ', ' ) } </p>
0 commit comments