Set up directadmin autodiscover to enable secure, automatic email configuration easily. Our DirectAdmin Support team is ready to assist you.
DirectAdmin Autodiscover
DirectAdmin Autodiscover lets email clients set up automatically using just an email and password. By creating an SRV record and a PHP subdomain, clients retrieve POP, IMAP, and SMTP settings securely. This guide shows how to set up the SRV record, subdomain, PHP script, SMTP, and redirection for seamless email configuration.
Read next to create the SRV record for DirectAdmin Autodiscover.
What is DirectAdmin Autodiscover
DirectAdmin Autodiscover is a tool within the DirectAdmin control panel that allows email clients to configure themselves automatically. Instead of manually entering server addresses, ports, and security settings, users only need their email address and password. The system retrieves the correct POP, IMAP, and SMTP settings from a dedicated subdomain.
When a user adds their email account, the client checks DNS for an SRV record that points to a subdomain hosting an XML configuration file. This file contains all the required information, enabling the email client to set up the account quickly and accurately.
Using Autodiscover reduces setup errors, saves time, and ensures that email clients like Outlook, Thunderbird, and Apple Mail connect seamlessly.
Prerequisites and SRV Record Setup
Before creating the SRV record, make sure you have:
- Access to your DNS host portal to manage domain records.
- An existing domain to add the SRV record to.
- Details about the service, including service type, protocol, port, and server FQDN.
- An existing A or AAAA record for the target host; it cannot be a CNAME.
- SSL/TLS certificates installed on the server for secure connections.
Steps to Create the SRV Record
- Log in to your DNS host portal.
- Go to the DNS management section for your domain.
- Click Add Record or Create Record.
- Select SRV as the record type.
- Enter the required information:
- Service Name: Precede with an underscore (e.g., _autodiscover).
- Protocol: Precede with an underscore (e.g., _tcp).
- Priority: Assign a numerical value; lower numbers are preferred.
- Weight: Assign a value for load balancing; higher values are preferred.
- Port: Enter the port the service runs on, typically 443.
- Target/Host: Enter the FQDN of the server hosting the service.
- Save the record to apply the changes.
Configuring SSL
The SRV record does not handle encryption. You must:
- Install a valid SSL/TLS certificate on the server.
- Configure the service, such as HTTPS, to use the certificate.
This ensures all communication through the service is secure while clients can automatically locate the server using the SRV record.
Creating the Autodiscover Subdomain and PHP Script
To enable DirectAdmin Autodiscover, start by creating a subdomain named autodiscover.hostname.com. This subdomain will host the PHP script that provides email clients with the correct POP, IMAP, and SMTP settings.
Steps to Set Up the Subdomain
- Log in to your DirectAdmin control panel.
- Navigate to the Subdomain Management section.
- Create a new subdomain called autodiscover.hostname.com.
- Ensure the subdomain points to the appropriate document root where your PHP script will reside.
Configuring the PHP Script
- Create a file named autodiscover.php under the subdomain’s document root.
- Add the XML code that defines server settings for IMAP, POP3, and SMTP.
- Use PHP to dynamically extract the email address from incoming requests and return the correct configuration.
- Save the file and verify it is accessible via https://autodiscover.hostname.com/autodiscover.php.
This setup allows email clients to automatically retrieve server settings and connect securely without manual configuration.
Configuring SMTP and SSL
To ensure secure email delivery, configure SMTP with the correct port and encryption in your email client or application.
Setting the SMTP Port and Encryption
- Port 465: Used for direct SSL/TLS connections. The connection starts encrypted immediately.
- Port 587: Used for email submission with STARTTLS, which upgrades an unencrypted connection to TLS. This port is widely recommended for modern clients.
- Encryption Type: In your client settings, select SSL/TLS or STARTTLS according to the chosen port.
Ensuring SSL/TLS Works Correctly
- Enable SSL/TLS: Make sure encryption is active in your email configuration.
-
- Match Ports and Encryption: Confirm that the port and encryption method correspond correctly.
- Authentication: Enable outgoing server authentication and enter the full email address and password. For accounts with two-factor authentication, use an app-specific password.
- Firewall Settings: Check that your firewall allows outbound connections on the selected SMTP port.
- Certificate Trust: Ensure the client trusts the server’s SSL certificate. Commercial certificates are typically trusted automatically; self-signed certificates may require manual approval.
Redirecting Requests with .htaccess
To ensure all Autodiscover requests are handled by your PHP script, you can redirect them using Apache’s .htaccess file. This captures requests for Autodiscover.xml and sends them to the script that provides the correct email client configuration.
Steps to Set Up the Redirect
- Enable mod_rewrite
Make sure the Apache mod_rewrite module is active on your server. Contact your hosting provider if you are unsure.
- Create or Edit .htaccess
Place the .htaccess file in the document root of your domain or the subdirectory where Autodiscover requests will occur.
- Add Rewrite Rules
Insert the following code:
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/Autodiscover/Autodiscover.xml [NC]
RewriteRule ^Autodiscover/Autodiscover.xml$ /path/to/your/autodiscover_handler.php [L]
- RewriteEngine On activates Apache’s rewrite engine.
- RewriteCond checks if the requested URL is Autodiscover.xml, ignoring the case.
- RewriteRule redirects the request to your PHP handler script. Replace /path/to/your/autodiscover_handler.php with the actual path.
- [L] flag ensures this is the last rule processed if matched.
This configuration ensures that all Autodiscover requests are processed by your script, allowing email clients to receive the correct server settings automatically.
Testing and Verification
After setting up the Autodiscover subdomain, PHP script, SRV record, and SSL, it is essential to test that email clients can automatically configure accounts correctly.
Methods to Test Autodiscover
- Use an Email Client
- Add a new email account in Outlook, Thunderbird, or Apple Mail.
- Enter the email address and password only.
- The client should automatically retrieve the server settings from your Autodiscover setup.
- Check with Online Tools
- Use services like Microsoft Remote Connectivity Analyzer to verify Autodiscover functionality.
- These tools test SRV records, SSL certificates, and the PHP script response.
- Verify SSL Configuration
- Access https://autodiscover.yourdomain.com/autodiscover.php in a browser.
- Ensure the SSL certificate is valid and trusted.
- Test Multiple Devices
- Check Autodiscover on desktop, mobile, and tablet clients to confirm consistent behavior across platforms.
- Review Logs
- Monitor your web server logs to ensure requests to Autodiscover are being correctly redirected to the PHP script.
Proper testing ensures that email clients can configure automatically, connections remain secure, and users experience a seamless setup process.
[Need assistance with a different issue? Our team is available 24/7.]
Conclusion
Setting up directadmin autodiscover ensures automatic, secure email configuration and reduces errors. Test across devices to confirm seamless connectivity and reliability.
In brief, our Support Experts demonstrated how to fix the “554 5.7.1 : Relay access denied” error.
0 Comments