mirror of
https://github.com/PanCakeConnaisseur/auto_mail_accounts.git
synced 2024-05-19 13:56:35 +02:00
Compare commits
18 commits
Author | SHA1 | Date | |
---|---|---|---|
ccd039bc5d | |||
d0bb178f65 | |||
7e90fbbdb0 | |||
7eae6ca654 | |||
67f7e634ac | |||
a221ca5110 | |||
82ffac407c | |||
84b715b1ad | |||
1ce9867999 | |||
7429e24e5a | |||
61e3c854e6 | |||
d66507d818 | |||
092a9f7d4b | |||
0277a00df0 | |||
3617171b7c | |||
0be05349d3 | |||
f7a5956553 | |||
5194345507 |
42
CHANGELOG.md
Normal file
42
CHANGELOG.md
Normal file
|
@ -0,0 +1,42 @@
|
|||
# Changelog
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [0.1.7] - 2020-10-13
|
||||
|
||||
### Fixed
|
||||
- Order of XML elements in appinfo/info.xml now conforms to XSD
|
||||
- removed .git files that were accidentally included
|
||||
|
||||
## [0.1.6] - 2020-10-07
|
||||
### Added
|
||||
- Compatibility with Nextcloud 20
|
||||
|
||||
|
||||
## [0.1.5] - 2020-09-17
|
||||
### Added
|
||||
- Compatibility with Nextcloud 19
|
||||
|
||||
|
||||
## [0.1.4] - 2020-03-10
|
||||
### Added
|
||||
- Compatibility with Nextcloud 16, 17, and 18
|
||||
|
||||
## [0.1.3] - 2018-12-14
|
||||
### Fixed
|
||||
- Fix a problem where user deletion or avatar change would fail if a user account did not have a mail account.
|
||||
|
||||
## [0.1.2] - 2018-12-14
|
||||
### Added
|
||||
- Compatibility with Nextcloud 15
|
||||
|
||||
## [0.1.1] - 2018-10-15
|
||||
### Added
|
||||
- Compatibility with Nextcloud 14
|
||||
|
||||
## [0.1.0] - 2018-06-07
|
||||
### Added
|
||||
- Initial release
|
||||
|
27
README.md
27
README.md
|
@ -1,7 +1,16 @@
|
|||
# Auto Mail Accounts
|
||||
The Nextcloud [mail app](https://apps.nextcloud.com/apps/mail) has a built-in default configuration for mail accounts but it does not create actual mail accounts for each Nextcloud user, so they can not store alternative identitites, a sender name, attachments or collect e-mail addresses. Each user would have to enter all the mail server info (e.g. host, port, username, password) individually.
|
||||
---
|
||||
# :warning: Obsolete
|
||||
The mail app has implemented all of this app's
|
||||
functionality in its recent versions (tested with mail 1.9.5). Accounts can be provisioned automatically, and
|
||||
it also updates a changed display name and password. Thus, this app will not be developed or maintained
|
||||
further. This repository will remain available.
|
||||
---
|
||||
|
||||
This app hooks into Nextcloud's user creation/deletion and display name/ password change and automatically creates/deletes/updates a mail account in the mail app. This creates mail accounts like if a user entered the settings manually allowing him to use all features of the mail app. This is useful if the login credentials for Nextcloud and the mail server are identical and the all Nextcloud users also have a mail account.
|
||||
# Auto Mail Accounts
|
||||
The Nextcloud [mail app](https://apps.nextcloud.com/apps/mail) has a built-in default configuration for
|
||||
mail accounts, but it does not create actual mail accounts for each Nextcloud user, so they can not store alternative identitites, a sender name, attachments or collect e-mail addresses. Each user would have to enter all the mail server info (e.g. host, port, username, password) individually.
|
||||
|
||||
This app hooks into Nextcloud's user creation/deletion and display name/ password change and automatically creates/deletes/updates a mail account in the mail app. This creates mail accounts like if a user entered the settings manually allowing him to use all features of the mail app. This is useful if the login credentials for Nextcloud and the mail server are identical and all Nextcloud users also have a mail account.
|
||||
|
||||
## Features
|
||||
Hooks into:
|
||||
|
@ -14,7 +23,7 @@ Hooks into:
|
|||
## Configuration
|
||||
If your Nextcloud login is identical to the e-mail address e.g. *user@example.com* and the mail server is on the same machine and uses default ports you don't need any configuration, because the default values below will be used.
|
||||
|
||||
If not you can configure this app by putting the following in Nextcloud's main configuration file in *config/config.php*. These are also the default values:
|
||||
If not, you can configure this app by putting the following in Nextcloud's main configuration file in *config/config.php*. These are also the default values:
|
||||
|
||||
'auto_mail_accounts' => array (
|
||||
'imap_host' => 'localhost',
|
||||
|
@ -26,11 +35,13 @@ If not you can configure this app by putting the following in Nextcloud's main c
|
|||
'email_address_suffix' => ''
|
||||
),
|
||||
|
||||
The key `email_address_suffx` goes into the main hierarchy level, where e.g. `trusted_domains` is.
|
||||
The key `auto_mail_accounts` goes into the main hierarchy level, where e.g. `trusted_domains` is.
|
||||
|
||||
If your users login as *user* (instead of *user@example.com*) you can set `email_address_suffix` to `@example.com` to automatically add this to the e-mail address of each user.
|
||||
|
||||
Valid ssl modes are `none`, `ssl` and `tls` as described in the [mail app documentation](https://github.com/nextcloud/mail/blob/master/doc/admin.md#minimal-configuration)
|
||||
Valid ssl modes are `none`, `ssl` and `tls` as described in the [mail app documentation](https://github.com/nextcloud/mail/blob/master/doc/admin.md#minimal-configuration).
|
||||
|
||||
Note that the email field during user creation in the Nextcloud user interface is ignored and set to the username (uid).
|
||||
## Security
|
||||
Note that the password is stored with symmetric encryption and can be retrieved by the admin. This is the default behaviour of the mail app whose methods this app uses.
|
||||
|
||||
|
@ -40,11 +51,9 @@ Set `'loglevel' => '0',` in Nextcloud's *config/config.php* to enable the app's
|
|||
## Cleanup
|
||||
Afaics the mail app has no mechanism to delete
|
||||
|
||||
- all collected e-mail addresses (i.e. addresses that are stored when you send someone an e-mail) of a user
|
||||
- all collected e-mail addresses (i.e., addresses that are stored when you send someone an e-mail) of a user
|
||||
- all references to attachments of a user
|
||||
|
||||
This means that if you delete a user, while his mail account and aliases will be deleted, his collected addresses and attachment references will remain in the db. This is not the *Auto Mail Account* app's fault.
|
||||
|
||||
This data can be found in the `oc_mail_attachments` and `oc_mail_collected_addresses` tables respectively.
|
||||
|
||||
|
||||
|
|
|
@ -8,17 +8,17 @@
|
|||
The mail app has a built-in default configuration for mail accounts but it does not create actual mail accounts for each Nextcloud user, so they can not store alternative identities, a sender name, attachments or collect e-mail addresses. This app hooks into Nextcloud's user creation/deletion and display name/ password change and automatically creates/deletes/updates a mail account in the mail app. This creates mail accounts like if a user entered the settings manually allowing him to use all features of the mail app.
|
||||
|
||||
Note that the password is stored with symmetric encryption and can be retrieved by the admin. This is the default behaviour of the mail app and unavoidable because it needs to login to the mail server.]]></description>
|
||||
<version>0.1.0</version>
|
||||
<version>0.1.7</version>
|
||||
<licence>agpl</licence>
|
||||
<author mail="dev@abelonline.de" >Alexey Abel</author>
|
||||
<author mail="dev@abelonline.de">Alexey Abel</author>
|
||||
<namespace>AutoMailAccounts</namespace>
|
||||
<documentation>
|
||||
<admin>https://github.com/PanCakeConnaisseur/auto_mail_accounts/blob/master/README.md</admin>
|
||||
</documentation>
|
||||
<namespace>AutoMailAccounts</namespace>
|
||||
<category>tools</category>
|
||||
<bugs>https://github.com/PanCakeConnaisseur/auto_mail_accounts/issues</bugs>
|
||||
<repository>https://github.com/PanCakeConnaisseur/auto_mail_accounts</repository>
|
||||
<dependencies>
|
||||
<nextcloud min-version="13" max-version="13"/>
|
||||
<nextcloud min-version="13" max-version="20"/>
|
||||
</dependencies>
|
||||
</info>
|
||||
|
|
|
@ -1,14 +1,15 @@
|
|||
{
|
||||
"hashes": {
|
||||
"CHANGELOG.md": "481ab1337c357d8007e6209b2a49bb91f8de3c95ae8c09c69f7eea5cf99da161e6507168d34bfb71be31374626468305a8b1b2101ae5937b6c91af21912f96b7",
|
||||
"LICENSE": "3a02a6ec14e9d076b79aea8301eab31053c6600b68dcfa6261e10edaa7296a87c8767e35f2411d234b90111fcaf6b4a55c49aa2790a1a0d015213218bb7549fc",
|
||||
"README.md": "ea9c25d658510840de942c9b655a115a2a1221b011ac160fe1b4bc6b584d127e9e09423ada2d3b11a34f5690c72aff899b8fcc0eb197cb7a564a3f905b8f96d6",
|
||||
"README.md": "a6551af01b71c1e72ad7d4ad748ae2d8a445a25ff3dea64bf121066c8b9118d3b4a41e72b9eaf862b24a407ce144e4f4c051be82dc4660ed46d8b774ae134941",
|
||||
"appinfo\/app.php": "5d34d23c4ae1731775832116446d6299cc94a1845fbb46596b937ce59cc79519415ccf65b771ef42abf5801b693ef54ccbf46079e050aaaaf7a1bf9ccbdc2d0b",
|
||||
"appinfo\/info.xml": "92badaca18bc9b3fa57c7bb0e8c2e247702b81a95c544a550b45a1759c25912d41fa7525dd9aedf6960268a761887f2d976e5d6f4755000eb007bfdb8c89ac60",
|
||||
"appinfo\/info.xml": "a8f50b8493797477ea9bec1d5b71c3d0a6ea8f3daf3c672ea66cc8ea00b5e4158f03dcdcbaf205c397ee428a18f9b2ec4b4aa2d7d07839067ca9721442c480a3",
|
||||
"img\/app.svg": "e90f4590585accfd0c16108cdddcb4f626ce16f5ec65af05d7070d16f3eb05dacf474b170a7907e23f154d7602a7d0d8d3e7a06b9a7644ba49825bffea41c340",
|
||||
"lib\/AppInfo\/Application.php": "77ccf1aab188f15f8a029ca3ed33776ff5881f755194a0e337cc63d568c6037614d2e0f032e4b06dd096fb5e40c8aa89c44276e8451a5b2339bef366d8c5f498",
|
||||
"lib\/Config.php": "fb9912b959fabcd6b6195753f374091d3dfc299c7edf102fb52f3b300edb799a0a1f998afa533973fc5d89caef386adfb9966720c0207008bc367e09581716c9",
|
||||
"lib\/Hooks\/UserHooks.php": "69db5b1498d08ee148570d3d97eb07b4bac0b9f56a0250fb6894a0a99b5949766bd2c2a1550e45d7770cff80ec2d84b676fa79e0c042b88d719def2e6e58c49b"
|
||||
"lib\/Hooks\/UserHooks.php": "49063ec087e4cdddae5802fbba1f52ddb699b7c6b25e3a1bd9c2533da807dc929695fb95437c47145874791652ef34cbd8a1379623fac8bd873896cf013c6c9b"
|
||||
},
|
||||
"signature": "Jgzoc4T78u94ZqFRoKkyTsr9nH0dGjYeafp0Z7EPwJi1xFuDqsTt\/pGeTogWTWiv9A1tWCchXEPWDvWS871FCpy10qglP00F1T75p\/YCxjjNRic6Wpw9FFSbL6chUg4w0vATN81nxlvGBwtRlzjlPBIwunT3Pl5wgLNkFcPehtN95QRKcPucYWp4L1IffEYzZGiP5Bih7FTsMQxg82fXipe\/j88+2zZPtXbU+Qpv\/BNaI9nVy+gq8cUXsgZW\/ilwiT3eK0bmFsFWvHS0On0J2CfqURh2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t2W2K0AV6k3KL4u6P0l99FOkVkg1mmHvVR\r\nBwluZ17urNFOVjAJutIwJru9XYm7lCb3a5zcZQHP5ZIO+TQ2X\/j+\/wIDAQABMA0G\r\nCSqGSIb3DQEBCwUAA4IBAQBglQNu9LCuaQwQY8HcrfPuptMJLfTnz9px9r+Rnv1D\r\nP4q26ZbTF1xhJlWRlcDCYI4QsjjXftIrc7aV2cOV1kMj3y9mmUA3K2gQhUw9GFRG\r\nhuY+YsRcKRtTvvVfd451YKNjY9x23XIiOIpZhZMqqNwCSIPMqWGRrsDHinMPiJa7\r\nWWKdLv75ItdQDC9R66fqVJuFlTZ\/5eG2bgRKmb\/wYqQMH1XzF72nlwpGmWoTkVYg\r\n\/DqQO6YdhB6mY5pZs95Ds61yWD+yaa1KA8Wq20yo+dPKqK+QlhHNQguUbGrrtj64\r\ncCrNZY2yEE2lXR2TkdlysHiqD767J0ArFjMwnhoAo8qj\r\n-----END CERTIFICATE-----"
|
||||
}
|
|
@ -86,13 +86,13 @@ class UserHooks {
|
|||
$account->setInboundHost($this->config->getImapHost());
|
||||
$account->setInboundPort($this->config->getImapPort());
|
||||
$account->setInboundSslMode($this->config->getImapSslMode());
|
||||
$account->setInboundUser($uid);
|
||||
$account->setInboundUser($email);
|
||||
$account->setInboundPassword($this->encrypt($password));
|
||||
|
||||
$account->setOutboundHost($this->config->getSmtpHost());
|
||||
$account->setOutboundPort($this->config->getSmtpPort());
|
||||
$account->setOutboundSslMode($this->config->getSmtpSslMode());
|
||||
$account->setOutboundUser($uid);
|
||||
$account->setOutboundUser($email);
|
||||
$account->setOutboundPassword($this->encrypt($password));
|
||||
|
||||
$this->accountService->save($account);
|
||||
|
@ -140,12 +140,11 @@ class UserHooks {
|
|||
|
||||
private function changeUserCallbackFunction() {
|
||||
return function (\OC\User\User $user, string $feature, string $value) {
|
||||
// The assumption is made that the automatically created mail
|
||||
// account is the first one, because it was automatically created
|
||||
// immediately after the creation of the user.
|
||||
$firstAccountsMailAccount = $this->getUsersFirstMailAccount($user);
|
||||
|
||||
if ($feature === 'displayName') {
|
||||
// The assumption is made that the automatically created mail
|
||||
// account is the first one, because it was automatically created
|
||||
// immediately after the creation of the user.
|
||||
$firstAccountsMailAccount = $this->getUsersFirstMailAccount($user);
|
||||
$firstAccountsMailAccount->setName($value);
|
||||
$this->accountService->save($firstAccountsMailAccount);
|
||||
$this->logger->debug("Automatically changed sender name for mail account"
|
||||
|
@ -181,4 +180,4 @@ class UserHooks {
|
|||
|
||||
return $accounts[0]->getMailAccount();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue