Skip to content

Instantly share code, notes, and snippets.

@Nilpo
Last active January 8, 2024 06:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Nilpo/65d106901531795bf5b5c3dcad425dda to your computer and use it in GitHub Desktop.
Save Nilpo/65d106901531795bf5b5c3dcad425dda to your computer and use it in GitHub Desktop.
Autoconfig config-v1.1.xml generator in PHP for Thunderbird mail client.
<?php
//get query data so we can extract the email address
$email = $_REQUEST['emailaddress'];
$domain = explode('@', $_REQUEST['emailaddress'])[1];
//set Content-Type
header("Content-Type: application/xml");
echo '<?xml version="1.0" encoding="utf-8" ?>'; ?>
<clientConfig version="1.1">
<emailProvider id="<?php echo $domain; ?>">
<domain><?php echo $domain; ?></domain>
<displayName><?php echo $email; ?></displayName>
<incomingServer type="imap">
<hostname>mail.<?php echo $domain; ?></hostname>
<port>993</port>
<socketType>SSL</socketType>
<username><?php echo $email; ?></username>
<authentication>password-cleartext</authentication>
</incomingServer>
<outgoingServer type="smtp">
<hostname>mail.<?php echo $domain; ?></hostname>
<port>587</port>
<socketType>STARTTLS</socketType>
<username><?php echo $email; ?></username>
<authentication>password-cleartext</authentication>
</outgoingServer>
</emailProvider>
</clientConfig>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ autoconfig.php [NC,L]
http://autoconfig.example.com/mail/config-v1.1.xml?emailaddress=user@domain.com
<?xml version="1.0" encoding="utf-8" ?>'; ?>
<clientConfig version="1.1">
<emailProvider id="example.com">
<domain>example.com</domain>
<displayName>user@example.com</displayName>
<incomingServer type="imap">
<hostname>mail.example.com</hostname>
<port>993</port>
<socketType>SSL</socketType>
<username>user@example.com</username>
<authentication>password-cleartext</authentication>
</incomingServer>
<outgoingServer type="smtp">
<hostname>smtp.example.com</hostname>
<port>587</port>
<socketType>STARTTLS</socketType>
<username>user@example.com</username>
<authentication>password-cleartext</authentication>
</outgoingServer>
</emailProvider>
</clientConfig>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment