41 lines
1.3 KiB
TypeScript
41 lines
1.3 KiB
TypeScript
import Controller from "wms-core/Controller";
|
|
import {Request, Response} from "express";
|
|
import MailDomain from "../models/MailDomain";
|
|
|
|
export default class MailAutoConfigController extends Controller {
|
|
public routes(): void {
|
|
this.get('/.well-known/autoconfig/mail/config-v1.1.xml', this.getAutoConfig, 'mail-auto-config');
|
|
}
|
|
|
|
/**
|
|
* See view and https://wiki.mozilla.org/Thunderbird:Autoconfiguration:ConfigFileFormat
|
|
*/
|
|
protected async getAutoConfig(req: Request, res: Response): Promise<void> {
|
|
res.contentType('text/xml');
|
|
const domains = await MailDomain.select().get();
|
|
res.render('mail-auto-config.xml.njk', {
|
|
domain: domains[0],
|
|
domains: domains,
|
|
display_name: 'Rainbox Email',
|
|
display_name_short: 'Rainbox',
|
|
username: '%EMAILADDRESS%',
|
|
auth_method: 'password-cleartext',
|
|
imap: {
|
|
server: 'rainbox.email',
|
|
port: '143',
|
|
method: 'STARTTLS',
|
|
},
|
|
pop3: {
|
|
server: 'rainbox.email',
|
|
port: '110',
|
|
method: 'STARTTLS',
|
|
},
|
|
smtp: {
|
|
server: 'rainbox.email',
|
|
port: '587',
|
|
method: 'STARTTLS',
|
|
},
|
|
});
|
|
}
|
|
}
|