firt commit
This commit is contained in:
commit
c2e63830e1
71 changed files with 9613 additions and 0 deletions
47
server/utils/emailService.js
Normal file
47
server/utils/emailService.js
Normal file
|
@ -0,0 +1,47 @@
|
|||
import nodemailer from 'nodemailer';
|
||||
|
||||
const transporter = nodemailer.createTransport({
|
||||
host: 'mail.pandem.fr',
|
||||
port: 465,
|
||||
secure: true,
|
||||
auth: {
|
||||
user: 'datacenter@nazuna.ovh',
|
||||
pass: '13,{,oCAlLaGENNiamoThFUllERpOrECriENI'
|
||||
}
|
||||
});
|
||||
|
||||
export const sendTicketEmail = async (ticketData, matchData, pdfPath) => {
|
||||
try {
|
||||
const mailOptions = {
|
||||
from: '"HandBall Tickets" <datacenter@nazuna.ovh>',
|
||||
to: ticketData.customerEmail,
|
||||
subject: `Your Ticket for ${matchData.name}`,
|
||||
html: `
|
||||
<div style="font-family: Arial, sans-serif; max-width: 600px; margin: 0 auto;">
|
||||
<h2 style="color: #2563eb;">Your Handball Match Ticket</h2>
|
||||
<div style="background-color: #1f2937; color: white; padding: 20px; border-radius: 8px;">
|
||||
<h3>${matchData.name}</h3>
|
||||
<p><strong>Date:</strong> ${new Date(matchData.date).toLocaleString('fr-FR')}</p>
|
||||
<p><strong>Location:</strong> ${matchData.location}</p>
|
||||
<p><strong>Seat Number:</strong> ${ticketData.seatNumber}</p>
|
||||
<p><strong>Ticket ID:</strong> ${ticketData.id}</p>
|
||||
</div>
|
||||
<p style="margin-top: 20px;">Thank you for your purchase! Your ticket is attached to this email.</p>
|
||||
</div>
|
||||
`,
|
||||
attachments: [
|
||||
{
|
||||
filename: `ticket-${ticketData.id}.pdf`,
|
||||
path: pdfPath
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
const info = await transporter.sendMail(mailOptions);
|
||||
console.log('Email sent:', info.messageId);
|
||||
return true;
|
||||
} catch (error) {
|
||||
console.error('Error sending email:', error);
|
||||
throw error;
|
||||
}
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue