sanduhrs / autoconfig
0.1.0
2018-04-09 06:29 UTC
This package is auto-updated.
Last update: 2024-09-05 15:48:09 UTC
README
这是Mozilla的自动配置的实现。目标是向电子邮件客户端提供所有必要信息,以便用户可以尽可能容易且安全地配置他们的电子邮件客户端。
在许多情况下,人们应该能够下载并安装Thunderbird,在账户设置向导中输入他们的真实姓名、电子邮件地址和密码,然后拥有一个完全功能的邮件客户端,并以尽可能安全的方式接收和发送邮件。 – https://mdn.org.cn/en-US/docs/Mozilla/Thunderbird/Autoconfiguration
完整使用示例
<?php
require __DIR__ . '/vendor/autoload.php';
use sanduhrs\Autoconfig\Autoconfig;
$autoconfig = new Autoconfig();
$autoconfig->setClientConfigUpdate('https://example.com/config.xml');
// Add provider configuration.
$provider = $autoconfig->setProvider('example.com');
$provider
->addDomain('example.com')
->addDomain('example.net')
->addDomain('example.org')
->setDisplayName('The example.com display name')
->setDisplayShortName('example.com short name');
// Common configuration.
$common = [
'hostname' => 'mail.example.com',
'username' => 'user@example.com',
'password' => 'a84wzrswm4tro8sm',
];
// Add servers in order of priority.
// Default SSL/TLS secured configuration.
$autoconfig->addImapServer($common);
// A STARTTLS secured configuration.
$autoconfig->addImapServer($common + [
'port' => 143,
'socketType' => 'STARTTLS',
]);
// A plain text configuration.
$autoconfig->addImapServer($common + [
'port' => 143,
'socketType' => 'plain',
]);
$autoconfig->addPop3Server($common);
$autoconfig->addPop3Server($common + [
'port' => 110,
'socketType' => 'plain',
]);
$autoconfig->addSmtpServer($common);
$autoconfig->addSmtpServer($common + [
'port' => 25,
'socketType' => 'plain',
]);
// Add web mail configuration.
$webMail = $autoconfig->setWebMail();
$webMail
->setLoginPageUrl('https://example.com/webmail')
->setLoginPageInfoUrl('https://example.com/webmail')
->setUsername($common['username'])
->setUsernameField('username', 'username')
->setPasswordField('password', 'password')
->setLoginButton('login', 'login');
print $autoconfig->toXml();
许可证
GPL 2或更高版本 https://gnu.ac.cn/licenses/old-licenses/gpl-2.0.txt