Skip to content

Commit 66c144e

Browse files
burnbabyburnymadmath03
authored
fix: autodiscover config
refactored imap/pop/smtp under single account added ssl property based on socket --------- Signed-off-by: madmath03 <[email protected]> Co-authored-by: y <[email protected]> Co-authored-by: madmath03 <[email protected]>
1 parent 620af02 commit 66c144e

File tree

2 files changed

+77
-96
lines changed

2 files changed

+77
-96
lines changed

index.js

+8-1
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,21 @@ function *autodiscover() {
5454
const popenc = settings.pop.socket === "STARTTLS" ? "TLS" : settings.pop.socket;
5555
const smtpenc = settings.smtp.socket === "STARTTLS" ? "TLS" : settings.smtp.socket;
5656

57+
const imapssl = settings.imap.socket === "SSL" ? "on" : "off";
58+
const popssl = settings.pop.socket === "SSL" ? "on" : "off";
59+
const smtpssl = settings.smtp.socket === "SSL" ? "on" : "off";
60+
5761
yield this.render("autodiscover", {
5862
schema: xmlns,
5963
email,
6064
username,
6165
domain,
6266
imapenc,
6367
popenc,
64-
smtpenc
68+
smtpenc,
69+
imapssl,
70+
popssl,
71+
smtpssl
6572
});
6673
}
6774

views/autodiscover.xml

+69-95
Original file line numberDiff line numberDiff line change
@@ -1,97 +1,71 @@
11
<?xml version="1.0" encoding="utf-8" ?>
2-
<Autodiscover xmlns="http://schemas.microsoft.com/exchange/autodiscover/responseschema/2006">
3-
<Response xmlns="{{schema}}">
4-
<User>
5-
<DisplayName>{{info.name}} Email</DisplayName>
6-
</User>
7-
8-
{%- if imap.host %}
9-
<Account>
10-
<AccountType>email</AccountType>
11-
<Action>settings</Action>
12-
<ServiceHome>{{info.url}}</ServiceHome>
13-
14-
<Protocol>
15-
<Type>IMAP</Type>
16-
<TTL>1</TTL>
17-
18-
<Server>{{imap.host}}</Server>
19-
<Port>{{imap.port}}</Port>
20-
21-
<LoginName>{{email}}</LoginName>
22-
23-
<DomainRequired>on</DomainRequired>
24-
<DomainName>{{domain}}</DomainName>
25-
26-
<SPA>off</SPA>
27-
<Encryption>{{imapenc}}</Encryption>
28-
<AuthRequired>on</AuthRequired>
29-
</Protocol>
30-
</Account>
31-
{% endif -%}
32-
33-
{%- if pop.host %}
34-
<Account>
35-
<AccountType>email</AccountType>
36-
<Action>settings</Action>
37-
<ServiceHome>{{info.url}}</ServiceHome>
38-
39-
<Protocol>
40-
<Type>POP</Type>
41-
<TTL>1</TTL>
42-
43-
<Server>{{pop.host}}</Server>
44-
<Port>{{pop.port}}</Port>
45-
46-
<LoginName>{{email}}</LoginName>
47-
48-
<DomainRequired>on</DomainRequired>
49-
<DomainName>{{domain}}</DomainName>
50-
51-
<SPA>off</SPA>
52-
<Encryption>{{popenc}}</Encryption>
53-
<AuthRequired>on</AuthRequired>
54-
</Protocol>
55-
</Account>
56-
{% endif -%}
57-
58-
{%- if smtp.host %}
59-
<Account>
60-
<AccountType>email</AccountType>
61-
<Action>settings</Action>
62-
<ServiceHome>{{info.url}}</ServiceHome>
63-
64-
<Protocol>
65-
<Type>SMTP</Type>
66-
<TTL>1</TTL>
67-
68-
<Server>{{smtp.host}}</Server>
69-
<Port>{{smtp.port}}</Port>
70-
71-
<LoginName>{{email}}</LoginName>
72-
73-
<DomainRequired>on</DomainRequired>
74-
<DomainName>{{domain}}</DomainName>
75-
76-
<SPA>off</SPA>
77-
<Encryption>{{smtpenc}}</Encryption>
78-
<AuthRequired>on</AuthRequired>
79-
</Protocol>
80-
</Account>
81-
{% endif -%}
82-
83-
{%- if mobilesync.url %}
84-
<Action>
85-
<Settings>
86-
<Server>
87-
<Type>MobileSync</Type>
88-
<Url>{{mobilesync.url}}</Url>
89-
{%- if mobilesync.name %}
90-
<Name>{{mobilesync.name}}</Name>
91-
{% endif -%}
92-
</Server>
93-
</Settings>
94-
</Action>
95-
{% endif -%}
96-
</Response>
2+
<Autodiscover
3+
xmlns="http://schemas.microsoft.com/exchange/autodiscover/responseschema/2006">
4+
<Response
5+
xmlns="{{schema}}">
6+
<User>
7+
<DisplayName>{{info.name}}</DisplayName>
8+
</User>
9+
<Account>
10+
<AccountType>email</AccountType>
11+
<Action>settings</Action>
12+
<ServiceHome>{{info.url}}</ServiceHome>
13+
{%- if imap.host %}
14+
<Protocol>
15+
<Type>IMAP</Type>
16+
<Server>{{imap.host}}</Server>
17+
<Port>{{imap.port}}</Port>
18+
<LoginName>{{email}}</LoginName>
19+
<DomainRequired>on</DomainRequired>
20+
<DomainName>{{domain}}</DomainName>
21+
<SPA>on</SPA>
22+
<SSL>{{imapssl}}</SSL>
23+
<Encryption>{{imapenc}}</Encryption>
24+
<AuthRequired>on</AuthRequired>
25+
</Protocol>
26+
{% endif -%}
27+
28+
{%- if pop.host %}
29+
<Protocol>
30+
<Type>POP</Type>
31+
<Server>{{pop.host}}</Server>
32+
<Port>{{pop.port}}</Port>
33+
<LoginName>{{email}}</LoginName>
34+
<DomainRequired>on</DomainRequired>
35+
<DomainName>{{domain}}</DomainName>
36+
<SPA>on</SPA>
37+
<SSL>{{popssl}}</SSL>
38+
<Encryption>{{popenc}}</Encryption>
39+
<AuthRequired>on</AuthRequired>
40+
</Protocol>
41+
{% endif -%}
42+
{%- if smtp.host %}
43+
<Protocol>
44+
<Type>SMTP</Type>
45+
<Server>{{smtp.host}}</Server>
46+
<Port>{{smtp.port}}</Port>
47+
<LoginName>{{email}}</LoginName>
48+
<DomainRequired>on</DomainRequired>
49+
<DomainName>{{domain}}</DomainName>
50+
<SPA>on</SPA>
51+
<SSL>{{smtpssl}}</SSL>
52+
<Encryption>{{smtpenc}}</Encryption>
53+
<AuthRequired>on</AuthRequired>
54+
</Protocol>
55+
{% endif -%}
56+
</Account>
57+
{%- if mobilesync.url %}
58+
<Action>
59+
<Settings>
60+
<Server>
61+
<Type>MobileSync</Type>
62+
<Url>{{mobilesync.url}}</Url>
63+
{%- if mobilesync.name %}
64+
<Name>{{mobilesync.name}}</Name>
65+
{% endif -%}
66+
</Server>
67+
</Settings>
68+
</Action>
69+
{% endif -%}
70+
</Response>
9771
</Autodiscover>

0 commit comments

Comments
 (0)