Skip to content

Commit

Permalink
installation guide
Browse files Browse the repository at this point in the history
  • Loading branch information
ArtificialOwl committed Oct 30, 2017
1 parent f5ece72 commit 31f80dc
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 29 deletions.
87 changes: 66 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,30 @@
### installation
### files_frommail

- need mailparse
**Files From Mail** allow an admin to link a drop-mailbox to Nextcloud.
This way, you can set a mail address (_files@example.net_ in our example) and every mails+attachments send to this mail address will be automatically be saved on the cloud.



![](https://raw.githubusercontent.com/nextcloud/files_frommail/master/screenshots/v0.1.0.png)


### dependencies

This app will need [Mailparse](http://php.net/manual/en/book.mailparse.php)
If not already installed on your server:

```
pecl install mailparse
$ sudo pecl install mailparse
```

if fail:
If the installation failed with a message about mbstring not installed (but mbstring is already installed) you will need to install the Mailparse extension manually:

```
pecl download mailparse
tar -zxvf mailparse-3.0.2.tgz
cd mailparse-3.0.2/
phpize
edit mailparse.c
$ pecl download mailparse
$ tar -zxvf mailparse-3.0.2.tgz
$ cd mailparse-3.0.2/
$ phpize
$ vi mailparse.c
```

remove lines 34-37:
Expand All @@ -22,26 +33,60 @@ remove lines 34-37:
> #endif
```
./configure --with-php-config=/usr/bin/php-config
make
make install
$ ./configure --with-php-config=/usr/bin/php-config
$ make
$ sudo make install
$ sudo echo "extension=mailparse.so" > /etc/php/7.0/mods-available/mailparse.ini
$ sudo ln -s /etc/php/7.0/mods-available/mailparse.ini /etc/php/7.0/apache2/conf.d/20-mailparse.ini
$ sudo apachectl restart
```



### configuration mail server

You now need to tell your mail server that any mails coming to a specific address (in our example: _files@mailserver.example.net_) will be redirected to a PHP script:
Add this line to **/etc/aliases**:

echo "extension=mailparse.so" > /etc/php/7.0/mods-available/mailparse.ini
> files: "|/usr/bin/php -f /path/to/NextcloudMailCatcher.php"
cd /etc/php/7.0/apache2/conf.d/
ln -s /etc/php/7.0/mods-available/mailparse.ini ./20-mailparse.ini
apachectl restart
_The NextcloudMailCatcher.php can be find in the /lib/ folder of the apps. The script is independant of the rest of the app and can be copied alone on your mail server_

Recreate the aliases db:
```
$ sudo newaliases
```

_Edit **NextcloudMailCatcher.php** and edit the few settings:


> $config = [
> 'nextcloud' => 'https://cloud.example.net/',
> 'username' => 'frommail',
> 'password' => 'Ledxc-jRFiR-wBMXD-jyyjt-Y87CZ',
> 'debug' => false
> ];
if **debug** is set to _true_, a log can be find in _/tmp/NextcloudMailParser.log_

### Virtual domain

In case you're using virtual domain (postfix), you will need to create an alias in your MTA:

> files@example.com -> files@mailserver.example.net


### Add the drop mailbox address to Nextcloud

To only create the right folder on the right mail address, the app will filters unknown mail addresses. You will need to add the drop-mailbox:

### configuration MTA:
> ./occ files_frommail:address --add files@example.com
new entry in /etc/aliases:
You can choose to secure the mails and ask for a password:

> files-artificial: "|/usr/bin/php -f /path/to/NextcloudMailCatcher.php"
> ./occ files_frommail:address --password files@example.com your_password
- execute _newaliases_
Doing so, only mails containing '**:your_password**' in their content will be saved.

- if virtual alias, create a new alias: files@artificial-owl.com -> files@hostname.example.net

14 changes: 7 additions & 7 deletions appinfo/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
<summary>Recover your email attachments from your cloud</summary>
<description><![CDATA[
Recover your email attachments from your cloud
Allows an admin to link a drop-mailbox to Nextcloud.
This way, you can set a mail address and every mails+attachments send to this mail address will be automatically be saved on the cloud.
]]>
</description>
Expand All @@ -15,17 +16,16 @@
<author>Maxence Lange</author>
<namespace>Files_FromMail</namespace>
<documentation>
<admin>https://github.com/daita/files_frommail/wiki</admin>
<admin>https://github.com/nextcloud/files_frommail/blob/master/README.md</admin>
</documentation>
<category>tools</category>
<category>files</category>
<category>social</category>

<website>https://github.com/daita/files_frommail</website>
<bugs>https://github.com/daita/files_frommail/issues</bugs>
<repository>https://github.com/daita/files_frommail.git</repository>
<!--<screenshot>-->
<!--</screenshot>-->
<website>https://github.com/nextcloud/files_frommail</website>
<bugs>https://github.com/nextcloud/files_frommail/issues</bugs>
<repository>https://github.com/nextcloud/files_frommail.git</repository>
<screenshot>https://raw.githubusercontent.com/nextcloud/files_frommail/master/screenshots/v0.1.0.png</screenshot>

<dependencies>
<nextcloud min-version="12" max-version="13"/>
Expand Down
2 changes: 1 addition & 1 deletion lib/NextcloudMailCatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@


$config = [
'nextcloud' => 'https://test.artificial-owl.com/',
'nextcloud' => 'https://cloud.example.net/',
'username' => 'frommail',
'password' => 'Ledxc-jRFiR-wBMXD-jyyjt-Y87CZ',
'debug' => false
Expand Down

0 comments on commit 31f80dc

Please sign in to comment.