Skip to main content

How to Configure autodiscover information for mail clients to setup pop/imap/smtp settings automatically on CentOS WebPanel?

Some mail clients will use a system called "Autodiscover" to figure out which settings to use for the pop/imap/smtp settings. You can set this up if you'd like, it basically requires a subdomain and a SRV record. You can add the SRV record into any domain you want to use these settings for.
If you've got a global SSL certificate in Postfix/dovecot for your hostname, this would be a good way to ensure clients use the correct value, so they don't get SSL certificate errors.
Let's assume you're going to have your clients with datahead.biz connect to host.datahead.biz for both IMAP and SMTP. So we have a subdomain called host.datahead.biz to store the XML, where host.datahead.biz is a Server FQDN . 
1.Setup a SRV record in the datahead.biz DNS zone:
_autodiscover._tcp.datahead.biz. 3600 IN SRV 10 10 443 host.datahead.biz.
2.Next, Creat a file named autodiscover.php on /usr/local/apache/htdocs/
# vi /usr/local/apache/htdocs/autodiscover.php 
Now Fix the permission
# cd /usr/local/apache/htdocs/
# chown nobody:nobody autodiscover.php
# chmod 755 autodiscover.php 
Note that the SRV record is using port 443 for host.datahead.biz, so make sure you've got a valid certificate setup for this subdomain. You can test by going to a https://host.datahead.biz to ensure you get a green lock.The script is looking for XML input in the tag to insert into the result field. 

If needed, you can set SMTP to use port 465, but you'd have to change the from TLS to SSL, as the protocol is different on 465. Port 587 requires smtp-auth but skips some spam checks and uses STARTTLS to enable SSL. Port 465 is full SSL but clients might have issues sending if their IP/range is in an RBL.

3. Lastly, we'll need to setup an .htaccess file so that any request to the host.dropkey.com subdomain results in the autodiscover.php being called. In the subdomain's DocumentRoot, add this code:
# cd /usr/local/apache/htdocs/
# vi .htaccess
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ autodiscover.php [NC,L] 
4. Add the redirect rules for http to https
5. Visit
http://host.datahead.biz
https://host.datahead.biz/autodiscover.php
6. Now Setup the outlook
Finally outlook will automatically discover all the settings .

Comments

Most Popular

CWP DNS Part 1 : How to Configure DNS properly for CentOS WebPanel on CentOS 7.6

After hosting my parent domain on CWP7.admin, I am getting dns error and i'm not able access my server using my server FQDN but i can access using my server IP.
So what can i do for that problem ?

Yes, you have to fix the error .

Environment Details:
Distro Name: CentOS Linux release 7.6.1810 (Core)
CentOS-Web Panel version: CWP7.admin
CWP version: 0.9.8.757
WebServer: Apache Only
FQDN: host.datahead.biz
IP: 192.120.10.3

1.Change Hostname Permanently:
# hostnamectl set-hostname host.datahead.biz# hostnamectl Static hostname: host.datahead.biz Icon name: computer-vm Chassis: vm Machine ID: 7400071490ea4f7d931374824ad4b52c Boot ID: 6e1f2d76495d4b318c25c4a1195aa130 Virtualization: vmware Operating System: CentOS Linux 7 (Core) CPE OS Name: cpe:/o:centos:centos:7 Kernel: Linux 3.10.0-862.14.4.el7.x86_64 Architecture: x86-64 It also writes this information to the /etc/hostname file as well.
# cat /etc/hostname host.d…

CWP DNS Part 2 : How to Configure DNS properly for CentOS WebPanel on CentOS 7.6

7.Open Main Configuration file
# vi /etc/named.conf 12 options { 13 listen-on port 53 { any; }; 14 listen-on-v6 port 53 { ::1; }; 15 directory "/var/named"; 16 dump-file "/var/named/data/cache_dump.db"; 17 statistics-file "/var/named/data/named_stats.txt"; 18 memstatistics-file "/var/named/data/named_mem_stats.txt"; 19 recursing-file "/var/named/data/named.recursing"; 20 secroots-file "/var/named/data/named.secroots"; 21 allow-query { any; }; 33 recursion no; 34 35 dnssec-enable yes; 36 dnssec-validation yes; 54 zone "." IN { 55 type hint; 56 file "named.ca"; 57 }; 58 59 include "/etc/named.rfc1912.zones"; 60 include "/etc/named.root.key"; 61 …