web/ponderings/mailautoconf/index.html
2024-05-31 17:02:09 +01:00

231 lines
13 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html lang="en">
<head>
<title>Mailautoconf | Paul&#x27;s Site of Stuff</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1">
<meta name="robots" content="noodp"/>
<link rel="stylesheet" href="https://paulwilde.uk/style.css">
<link rel="stylesheet" href="https://paulwilde.uk/color/orange.css">
<link rel="stylesheet" href="https://paulwilde.uk/color/background_blue.css">
<link rel="stylesheet" href="https://paulwilde.uk/font-hack.css">
<meta name="description" content="a simple, configurable autodiscover/autoconfig service for distributed and self-hosted services.">
<meta property="og:description" content="a simple, configurable autodiscover/autoconfig service for distributed and self-hosted services.">
<meta property="og:title" content="Mailautoconf | Paul's Site of Stuff">
<meta property="og:type" content="article">
<meta property="og:url" content="https://paulwilde.uk/ponderings/mailautoconf/">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:description" content="a simple, configurable autodiscover/autoconfig service for distributed and self-hosted services.">
<meta name="twitter:title" content="Mailautoconf | Paul's Site of Stuff">
<meta property="twitter:domain" content="paulwilde.uk">
<meta property="twitter:url" content="https://paulwilde.uk/ponderings/mailautoconf/">
<link rel="alternate" type="application/atom+xml" title="RSS" href="https://paulwilde.uk/atom.xml">
<link rel="shortcut icon" type="image&#x2F;x-icon" href="/favicon.png">
</head>
<body class="">
<div class="container">
<header class="header">
<div class="header__inner">
<div class="header__logo">
<a href="/" style="text-decoration: none;">
<div class="logo">
Hello, I&#x27;m Paul
</div>
</a>
</div>
</div>
<nav class="menu">
<ul class="menu__inner">
<li><a href="/">home</a></li>
<li><a href="/aboutme">about me</a></li>
<li><a href="/ponderings">ponderings</a></li>
<li><a href="/iuse">i use…</a></li>
<li><a href="/tags">tags</a></li>
<li><a href="/atom.xml">rss</a></li>
</ul>
</nav>
</header>
<div class="home-content">
<div class="post">
<h1 class="post-title"><a href="https://paulwilde.uk/ponderings/mailautoconf/">Mailautoconf</a></h1>
<div class="post-meta-inline">
<span class="post-date">
2021-08-17
</span>
</div>
<span class="post-tags-inline">
:: tags:&nbsp;
<a class="post-tag" href="https://paulwilde.uk/tags/development/">#development</a></span>
<div class="post-content">
<h3 id="a-simple-configurable-autodiscover-autoconfig-service-for-distributed-and-self-hosted-services">A simple, configurable autodiscover/autoconfig service for distributed and self-hosted services.</h3>
<p>Codeberg = <a href="https://codeberg.org/pswilde/mailautoconf">codeberg link</a></p>
<h3 id="what-is-mailautoconf">What is MailAutoConf?</h3>
<p>MailAutoConf is autodiscover/autoconfig web server for self-hosted mail services
which do not have their own autodiscover service.</p>
<span id="continue-reading"></span><h3 id="what-does-mailautoconf-do">What does MailAutoConf do?</h3>
<p>MailAutoConf is currently in <em>very</em> early stages, but it does generate valid
autoconfig XML files (<code>/mail/config-v1.1.xml</code>) compatible with many mail clients
i.e. <code>Thunderbird</code>, <code>Evolution</code>, etc.<br />
Theoretically, anything that can read the standard autoconfig XML file -
<code>https://wiki.mozilla.org/Thunderbird:Autoconfiguration:ConfigFileFormat</code>, should
be able to auto-configure using this service.</p>
<h3 id="installation">Installation</h3>
<p>MailAutoConf runs its own webserver on port <code>8010</code>.
You will need to supply a volume for the configuration file and port forwarding.</p>
<pre data-lang="sh" style="background-color:#212121;color:#eeffff;" class="language-sh "><code class="language-sh" data-lang="sh"><span style="color:#82aaff;">podman run</span><span style="color:#89ddff;"> -</span><span style="color:#f78c6c;">dt </span><span style="color:#89ddff;">\
</span><span style="color:#89ddff;"> --</span><span style="color:#f78c6c;">name</span><span style="color:#82aaff;"> mailautoconf </span><span style="color:#89ddff;">\
</span><span style="color:#89ddff;"> -</span><span style="color:#f78c6c;">v</span><span style="color:#82aaff;"> ./config:/mailautoconf/config </span><span style="color:#89ddff;">\
</span><span style="color:#89ddff;"> -</span><span style="color:#f78c6c;">p</span><span style="color:#82aaff;"> 8010:8010 </span><span style="color:#89ddff;">\
</span><span style="color:#82aaff;"> pswilde/mailautoconf
</span></code></pre>
<p>You will need a reverse proxy server to publish to the outside world and handle SSL encryption.<br />
For example, in nginx:</p>
<pre data-lang="conf" style="background-color:#212121;color:#eeffff;" class="language-conf "><code class="language-conf" data-lang="conf"><span style="font-style:italic;color:#c792ea;">server </span><span>{
</span><span> </span><span style="color:#f78c6c;">listen 443</span><span> ssl;
</span><span> </span><span style="color:#f78c6c;">server_name </span><span>autoconfig</span><span style="color:#89ddff;">.</span><span>example</span><span style="color:#89ddff;">.</span><span>com;
</span><span> </span><span style="color:#f78c6c;">ssl_certificate </span><span style="color:#89ddff;">/</span><span>path</span><span style="color:#89ddff;">/</span><span>to</span><span style="color:#89ddff;">/</span><span>certificate</span><span style="color:#89ddff;">.</span><span>file;
</span><span> </span><span style="color:#f78c6c;">ssl_certificate_key </span><span style="color:#89ddff;">/</span><span>path</span><span style="color:#89ddff;">/</span><span>to</span><span style="color:#89ddff;">/</span><span>certificate</span><span style="color:#89ddff;">.</span><span>key
</span><span style="color:#c792ea;"> location </span><span style="color:#89ddff;">/</span><span> {
</span><span> </span><span style="color:#f78c6c;">proxy_set_header X</span><span style="color:#89ddff;">-</span><span>Forwarded</span><span style="color:#89ddff;">-</span><span>Host $host</span><span style="color:#89ddff;">:</span><span>$server_port;
</span><span> </span><span style="color:#f78c6c;">proxy_set_header X</span><span style="color:#89ddff;">-</span><span>Forwarded</span><span style="color:#89ddff;">-</span><span>Server $host;
</span><span> </span><span style="color:#f78c6c;">proxy_set_header X</span><span style="color:#89ddff;">-</span><span>Forwarded</span><span style="color:#89ddff;">-</span><span>For $proxy_add_x_forwarded_for;
</span><span> </span><span style="color:#f78c6c;">proxy_pass </span><span>http://localhost:8010</span><span style="color:#89ddff;">/</span><span>;
</span><span> </span><span style="color:#f78c6c;">proxy_redirect </span><span>http://localhsot:8010</span><span style="color:#89ddff;">/ /</span><span>;
</span><span> </span><span style="color:#f78c6c;">proxy_read_timeout 60s</span><span>;
</span><span> }
</span><span>}
</span></code></pre>
<p>First run will create <code>sample.yaml</code> files in the config directory. Copy these to <code>config.yaml</code> and <code>services.yaml</code> and configure them to your needs.</p>
<p>MailAutoConf will handle all the URLs its able to deal with, i.e. <code>/mail/config-v1.1.xml</code>, <code>/Autodiscover/Autodiscover.xml</code> automatically.</p>
<h3 id="dns-config">DNS config</h3>
<p>You will need to configure DNS records for your domain.<br />
I would recommend setting up an A record for <code>autoconfig.your.domain</code> to point
directly to your MailAutoConfs instance which will work for Thunderbird and
Evolution clients.
Then, if Outlook Autodiscover is required (currently not implemented), configure
a <code>SRV</code> record to redirect to the <code>autoconfig.your.domain</code> <code>A</code> record. i.e.</p>
<pre style="background-color:#212121;color:#eeffff;"><code><span>Type TTL P M Port Target
</span><span>SRV _autodiscover._tcp.your.domain 3600 10 10 443 autoconfig.your.domain
</span></code></pre>
<h3 id="compatibility">Compatibility</h3>
<p>MailAutoConf has been tested and confirmed working with the following software packages</p>
<ul>
<li><input disabled="" type="checkbox" checked=""/>
Thunderbird (v78 and probably earlier versions too)</li>
<li><input disabled="" type="checkbox" checked=""/>
Evolution Mail (v3.40.3 and probably earlier versions too)</li>
<li><input disabled="" type="checkbox" checked=""/>
Nextcloud Mail app</li>
<li><input disabled="" type="checkbox"/>
Other Mail Clients are likely supported if they support /mail/config-v1.1.xml</li>
</ul>
<h3 id="future-plans">Future plans</h3>
<p>MailAutoConf is currently in <em>very</em> early stages, with a <em>very</em> limited set of features.
My hope for MailAutoConf is to run as an autoconfig service which provides Calendar and AddressBook locations as well.
Calendar and AddressBook is in the autoconfig XML documentation, but currently not implemented. MailAutoConf can generate the correct information for Calendar and AddressBook into the autoconfig XML file, though no clients currently use it.</p>
<h3 id="todo">TODO:</h3>
<ul>
<li><input disabled="" type="checkbox" checked=""/>
/mail/config-v1.1.xml file for Thunderbird and Evolution mail clients.</li>
<li><input disabled="" type="checkbox"/>
Add more code commenting, its pretty terrible right now.</li>
<li><input disabled="" type="checkbox"/>
Refactor the autoconfig and autodiscover XML files, theyve been copied and bodged together and could look so much better.</li>
<li><input disabled="" type="checkbox"/>
Autodiscover.xml for Outlook clients - currently does generate, but untested.</li>
<li><input disabled="" type="checkbox"/>
Autodiscover.json for more modern Outlook clients - this is currently undocumented. I have implemented some features of it but it is currently not working.</li>
<li><input disabled="" type="checkbox"/>
Calendars and Address Book - does generate into mail/config-v1.1.xml, but no actual clients support it yet.</li>
<li><input disabled="" type="checkbox"/>
Additional, custom services. For example, Nextcloud - instead of having to type in your Nextcloud instance URL, you can just enter your email address associated with you Nextcloud account and it looks up the URL from autoconfig - wouldnt that be nice?</li>
<li><input disabled="" type="checkbox"/>
Probably loads of stuff I havent thought of yet.</li>
</ul>
<h3 id="when-will-it-be-ready-for-production">When will it be ready for production?</h3>
<p>Well, not yet. Though it does sort of work already.<br />
Im working on this ultimately for my own use for my own small business. Im hoping once its good enough I could deploy the set up to my businesses customers and ultimately get them away from a Microsoft Exchange based environment. Theres a long way to go for that right now though.</p>
<p>If you feel you may be able to help, or ideas on features and their implementation, notice any bugs, or just want to say hi. Please do so and submit a pull request if required.</p>
<p>Thanks for reading!</p>
</div>
<div class="pagination">
<div class="pagination__title">
<span class="pagination__title-h">Thanks for reading! Read other posts?</span>
<hr />
</div>
<div class="pagination__buttons">
<span class="button previous">
<a href="https://paulwilde.uk/ponderings/skeletor/">
<span class="button__icon"></span>&nbsp;
<span class="button__text">St Skeletor&#x27;s Day</span>
</a>
</span>
<span class="button next">
<a href="https://paulwilde.uk/ponderings/peanut-butter/">
<span class="button__text">Peanut Butter Recipe</span>&nbsp;
<span class="button__icon"></span>
</a>
</span>
</div>
</div>
</div>
</div>
<footer class="footer">
<div class="footer__inner">
<div class="copyright copyright--user">Paul Wilde 2024 :: Theme&nbsp;<a href="https://github.com/pawroman/zola-theme-terminimal/">Terminimal</a></div>
</div>
</footer>
</div>
</body>
</html>