mirror of
https://github.com/YunoHost-Apps/rainloop_ynh.git
synced 2024-09-03 20:16:18 +02:00
Add
This commit is contained in:
parent
90a70807ad
commit
b7bd5abead
7 changed files with 128 additions and 0 deletions
16
conf/data/domains/default.ini
Normal file
16
conf/data/domains/default.ini
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
imap_host = "auto"
|
||||||
|
imap_port = 993
|
||||||
|
imap_secure = "SSL"
|
||||||
|
imap_short_login = Off
|
||||||
|
sieve_use = Off
|
||||||
|
sieve_allow_raw = Off
|
||||||
|
sieve_host = ""
|
||||||
|
sieve_port = 4190
|
||||||
|
sieve_secure = "None"
|
||||||
|
smtp_host = "auto"
|
||||||
|
smtp_port = 465
|
||||||
|
smtp_secure = "SSL"
|
||||||
|
smtp_short_login = Off
|
||||||
|
smtp_auth = On
|
||||||
|
smtp_php_mail = Off
|
||||||
|
white_list = ""
|
7
hooks/post_domain_add
Normal file
7
hooks/post_domain_add
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
app='rainloop' # This could never work with multi-instance. Need to find a better way
|
||||||
|
domain=$1
|
||||||
|
rainloop_path=/var/www/$app/app
|
||||||
|
|
||||||
|
sudo cp ../conf/data/domains/domain.tld.ini $rainloop_path/data/_data_/_default_/domains/$domain.ini
|
7
hooks/post_domain_remove
Normal file
7
hooks/post_domain_remove
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
app='rainloop' # This could never work with multi-instance. Need to find a better way
|
||||||
|
domain=$1
|
||||||
|
rainloop_path=/var/www/$app/app
|
||||||
|
|
||||||
|
sudo rm $rainloop_path/data/_data_/_default_/domains/$domain.ini
|
27
sources/plugins/auto-domain-grab/LICENSE
Normal file
27
sources/plugins/auto-domain-grab/LICENSE
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
This plugin, written by https://github.com/jas8522
|
||||||
|
and optimised by
|
||||||
|
https://github.com/rhyswilliamsza
|
||||||
|
https://github.com/rhysit
|
||||||
|
https://github.com/RainLoop
|
||||||
|
is released under:
|
||||||
|
|
||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Copyright (c) 2015 https://github.com/jas8522
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
this software and associated documentation files (the "Software"), to deal in
|
||||||
|
the Software without restriction, including without limitation the rights to
|
||||||
|
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||||
|
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||||
|
subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||||
|
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||||
|
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||||
|
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
|
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
14
sources/plugins/auto-domain-grab/README
Normal file
14
sources/plugins/auto-domain-grab/README
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
What is it?
|
||||||
|
|
||||||
|
In essense, this plugin allows for multiple users across multiple servers to use one RainLoop installation,
|
||||||
|
all without the administrator needing to create each domain separately. This plugin detects the required
|
||||||
|
hostname from the inputted email address (for example, it would detect "example.com" as the hostname if
|
||||||
|
"info@example.com" is inputted). This hostname is then used for IMAP and SMTP communication.
|
||||||
|
|
||||||
|
How to Use:
|
||||||
|
|
||||||
|
1) Activate plugin
|
||||||
|
2) Visit Settings, and add a new wildcard domain "*"
|
||||||
|
3) Set your ports/ssl requirements as needed. These will not be changed by the plugin.
|
||||||
|
4) In the SMTP and/or IMAP host fields, place the single word "auto". This will be replaced when the plugin is active.
|
||||||
|
5) That's it! The plugin should now work!
|
1
sources/plugins/auto-domain-grab/VERSION
Normal file
1
sources/plugins/auto-domain-grab/VERSION
Normal file
|
@ -0,0 +1 @@
|
||||||
|
1.1
|
56
sources/plugins/auto-domain-grab/index.php
Normal file
56
sources/plugins/auto-domain-grab/index.php
Normal file
|
@ -0,0 +1,56 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This plug-in automatically detects the IMAP and SMTP settings by extracting them from the email address itself.
|
||||||
|
* For example, user inputs: "info@example.com"
|
||||||
|
* This plugin sets the IMAP and SMTP host to "example.com" upon login, and then connects to it.
|
||||||
|
*
|
||||||
|
* Based on:
|
||||||
|
* https://github.com/RainLoop/rainloop-webmail/blob/master/plugins/override-smtp-credentials/index.php
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
class AutoDomainGrabPlugin extends \RainLoop\Plugins\AbstractPlugin
|
||||||
|
{
|
||||||
|
public function Init()
|
||||||
|
{
|
||||||
|
$this->addHook('filter.smtp-credentials', 'FilterSmtpCredentials');
|
||||||
|
$this->addHook('filter.imap-credentials', 'FilterImapCredentials');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function detects the IMAP Host, and if it is set to "auto", replaces it with the email domain.
|
||||||
|
*
|
||||||
|
* @param \RainLoop\Model\Account $oAccount
|
||||||
|
* @param array $aImapCredentials
|
||||||
|
*/
|
||||||
|
public function FilterImapCredentials($oAccount, &$aImapCredentials)
|
||||||
|
{
|
||||||
|
if ($oAccount instanceof \RainLoop\Model\Account && \is_array($aImapCredentials))
|
||||||
|
{
|
||||||
|
// Check for mail.$DOMAIN as entered value in RL settings
|
||||||
|
if (!empty($aImapCredentials['Host']) && 'auto' === $aImapCredentials['Host'])
|
||||||
|
{
|
||||||
|
$aImapCredentials['Host'] = \MailSo\Base\Utils::GetDomainFromEmail($oAccount->Email());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function detects the SMTP Host, and if it is set to "auto", replaces it with the email domain.
|
||||||
|
*
|
||||||
|
* @param \RainLoop\Model\Account $oAccount
|
||||||
|
* @param array $aSmtpCredentials
|
||||||
|
*/
|
||||||
|
public function FilterSmtpCredentials($oAccount, &$aSmtpCredentials)
|
||||||
|
{
|
||||||
|
if ($oAccount instanceof \RainLoop\Model\Account && \is_array($aSmtpCredentials))
|
||||||
|
{
|
||||||
|
// Check for mail.$DOMAIN as entered value in RL settings
|
||||||
|
if (!empty($aSmtpCredentials['Host']) && 'auto' === $aSmtpCredentials['Host'])
|
||||||
|
{
|
||||||
|
$aSmtpCredentials['Host'] = \MailSo\Base\Utils::GetDomainFromEmail($oAccount->Email());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue