feat: initial release of Titan 3D Web Application
CI/CD Pipeline / Build & Validate (push) Canceled after 0s
CI/CD Pipeline / Docker Build Validation (push) Canceled after 0s

This commit is contained in:
2026-08-28 18:04:12 +05:30
commit 10bd0a085f
104 changed files with 17905 additions and 0 deletions
+46
View File
@@ -0,0 +1,46 @@
const nodemailer = require('nodemailer');
require('dotenv').config();
const transporter = nodemailer.createTransport({
host: process.env.SMTP_HOST || 'smtp.office365.com',
port: parseInt(process.env.SMTP_PORT || '587', 10),
secure: process.env.SMTP_SECURE === 'true', // true for 465, false for other ports (587 uses STARTTLS)
auth: {
user: process.env.SMTP_USER,
pass: process.env.SMTP_PASS,
},
tls: {
ciphers: 'SSLv3', // sometimes required for Office365
rejectUnauthorized: false
}
});
/**
* Sends an email using the configured SMTP server.
* @param {string} to - Recipient email address
* @param {string} subject - Email subject
* @param {string} text - Plain text body
* @param {string} html - HTML body (optional)
* @returns {Promise<any>} Info object from nodemailer
*/
const sendMail = async (to, subject, text, html = '') => {
try {
const info = await transporter.sendMail({
from: process.env.SMTP_FROM,
to,
subject,
text,
html
});
console.log(`Email sent to ${to}: ${info.messageId}`);
return info;
} catch (error) {
console.error('Error sending email:', error);
throw error;
}
};
module.exports = {
sendMail,
transporter
};