cal/lib/serverConfig.ts
Alex van Andel cf3713d3a1 Implemented mailing for Calendso instances
added two templates, confirm-booked (sent to invitee) and new-event (sent to agent, for the time being only when no calendar integrations exist).
2021-05-27 22:10:20 +00:00

33 lines
698 B
TypeScript

function detectTransport(): string | any {
if (process.env.EMAIL_SERVER) {
return process.env.EMAIL_SERVER;
}
if (process.env.EMAIL_SERVER_HOST) {
const port = parseInt(process.env.EMAIL_SERVER_PORT);
const transport = {
host: process.env.EMAIL_SERVER_HOST,
port,
auth: {
user: process.env.EMAIL_SERVER_USER,
pass: process.env.EMAIL_SERVER_PASSWORD,
},
secure: (port === 465),
};
return transport;
}
return {
sendmail: true,
newline: 'unix',
path: '/usr/sbin/sendmail'
};
}
export const serverConfig = {
transport: detectTransport(),
from: process.env.EMAIL_FROM,
};