firt commit
This commit is contained in:
commit
c2e63830e1
71 changed files with 9613 additions and 0 deletions
34
server/utils/email.js
Executable file
34
server/utils/email.js
Executable file
|
@ -0,0 +1,34 @@
|
|||
import nodemailer from 'nodemailer';
|
||||
import dotenv from 'dotenv';
|
||||
|
||||
dotenv.config();
|
||||
|
||||
// Create a transporter using SMTP
|
||||
const transporter = nodemailer.createTransport({
|
||||
host: 'mail.pandem.fr',
|
||||
port: 465,
|
||||
secure: true, // SSL
|
||||
auth: {
|
||||
user: 'datacenter@nazuna.ovh',
|
||||
pass: '13,{,oCAlLaGENNiamoThFUllERpOrECriENI'
|
||||
}
|
||||
});
|
||||
|
||||
export async function sendEmail({ to, subject, text, attachments = [] }) {
|
||||
try {
|
||||
const mailOptions = {
|
||||
from: '"HandBall Ticketer" <datacenter@nazuna.ovh>',
|
||||
to,
|
||||
subject,
|
||||
text,
|
||||
attachments
|
||||
};
|
||||
|
||||
const info = await transporter.sendMail(mailOptions);
|
||||
console.log('Email sent:', info.messageId);
|
||||
return info;
|
||||
} catch (error) {
|
||||
console.error('Error sending email:', error);
|
||||
throw error;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue