Is it possible to setup AutoDiscover for MS mail client config


#1

I see other linux users have managed it here https://serverfault.com/questions/244660/is-there-a-way-to-use-the-autodiscover-feature-without-exchange

It would be nice if this was baked into symbiosis.


#2

It looks like it’s quite easy.

Make sure you have https:// enabled for your website. This should be as easy as putting “letsencrypt” into your website’s …/config/ssl-provider file.

Create the …/public/htdocs/autodiscover/ directory for your website create two files, .htaccess and autodiscover.php:

.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]

autodiscover.php

<?php
//get raw POST data so we can extract the email address
$data = file_get_contents("php://input");
preg_match("/\<EMailAddress\>(.*?)@(.*?)\<\/EMailAddress\>/", $data, $matches);

//set Content-Type
header("Content-Type: application/xml");
?>
<?php echo '<?xml version="1.0" encoding="utf-8" ?>'; ?>
<Autodiscover xmlns="http://schemas.microsoft.com/exchange/autodiscover/responseschema/2006">
	<Response xmlns="http://schemas.microsoft.com/exchange/autodiscover/outlook/responseschema/2006a">
		<Account>
			<AccountType>email</AccountType>
			<Action>settings</Action>
<!--			<Protocol>
				<Type>POP3</Type>
				<Server>mail.<?php echo $matches[2]; ?></Server>
				<Port>110</Port>
				<LoginName><?php echo $matches[1]; ?>@<?php echo $matches[2]; ?></LoginName>
				<DomainRequired>off</DomainRequired>
				<SPA>off</SPA>
				<SSL>on</SSL>
				<AuthRequired>on</AuthRequired>
				<DomainRequired>off</DomainRequired>
			</Protocol> -->
			<Protocol>
				<Type>IMAP</Type>
				<Server>mail.<?php echo $matches[2]; ?></Server>
				<Port>143</Port>
				<DomainRequired>on</DomainRequired>
				<LoginName><?php echo $matches[1]; ?>@<?php echo $matches[2]; ?></LoginName>
				<SPA>on</SPA>
				<SSL>off</SSL>
                <Encryption>TLS</Encryption>
				<AuthRequired>on</AuthRequired>
			</Protocol>
			<Protocol>
				<Type>SMTP</Type>
				<Server>mail.<?php echo $matches[2]; ?></Server>
				<Port>25</Port>
				<DomainRequired>off</DomainRequired>
				<LoginName><?php echo $matches[1]; ?>@<?php echo $matches[2]; ?></LoginName>
				<SPA>on</SPA>
				<SSL>off</SSL>
                <Encryption>TLS</Encryption>
				<AuthRequired>on</AuthRequired>
				<UsePOPAuth>on</UsePOPAuth>
				<SMTPLast>off</SMTPLast>
			</Protocol>
		</Account>
	</Response>
</Autodiscover>

That’s it. Now when your client put their name, email address and password into the new account window in outlook and the windows 10 Mail app the auto-discover process will look at this file and set up the fiddly bits of the account for them.


#3

The next one to figure out is how to setup the same for Mozilla Thunderbird, there are some instructions here to get me started.


#4

Just found this after posting new topic. Does anyone have autodiscover working for email accounts on SymStretch?