[New Plugin] Configure and use fetchmail from the WebApp

Greetings,

i’ve developed a plugin to configure fetchmail within the Kopano WebApp.
It started out as a project only for private use, but its running stable so far, and maybe there is an interest for it.
I’ve polished it up a bit and uploaded the plugin to github:

https://github.com/olia-dev/kopano-webapp-fetchmail/

Warning: It’s running stable polling ~12 accounts every 2-5 Minutes. I’ve had it up to ~20. Anything more than that is untested.

Feel free to use & modify it. Feedback and Bug reports are always welcome ;-)

That’s great, I am sure it will be very very useful, I’ll give it a try as soon as I can.

@mcostan Thanks.

I’ve also added some screenshots to the github page.

Hi Olia,

Thanks for sharing. Looks promising.

Great work @olia :thumbsup:

I’ll be rolling it out shortly and will report back with any bugs/issues.

UPDATE: Runs great! Thanks again =)

Cheers
W

Great Plugin !!!

I asked for that for years, beginning with my zarafa 6.4 experiments!

Thanks a lot !!

Hi,

I have copied the GIT code to:
/usr/share/kopano-webapp/plugins/fetchmail

then copied the config.php to /etc/kopano/webapp/config-fetchmail.php

restarted apache2 but the new plugin does not come up.

I am doing something wrong?

@Marty @Wiz @teka74 Thanks ;-)

@mcostan

Did you create a symlink from /etc/kopano/webapp/config-fetchmail.php to /usr/share/kopano-webapp/plugins/fetchmail/config.php ?

Otherwise could you please post the apache2 error log?

Here it is:

root@mrc-ubz64:/etc/kopano/webapp# ls -rtl config-fetchmail.php
lrwxrwxrwx 1 root root 53 Mar 16 16:32 config-fetchmail.php -> /usr/share/kopano-webapp/plugins/fetchmail/config.php
root@mrc-ubz64:/etc/kopano/webapp# ls -lrt /usr/share/kopano-webapp/plugins/fetchmail/config.php
-rw-r–r-- 1 root root 1065 Mar 16 16:32 /usr/share/kopano-webapp/plugins/fetchmail/config.php

The error log doesn’t mention fetchmail at all…

I am sure this is something I am doing wrong though.

Did you activate the plugin in the kopano settings?

@olia

Apologies I think this is me being stupid.

[Thu Mar 16 16:41:21.550162 2017] [core:info] [pid 23167] [client 127.0.0.1:36071] AH00128: File does not exist: /usr/share/kopano-webapp/plugins/fetchmail/resources/css/fetchmail.css, referer: https://z.advanced-finance.com/webapp/
[Thu Mar 16 16:41:22.220274 2017] [core:info] [pid 23174] [client ::1:46690] AH00128: File does not exist: /usr/share/kopano-webapp/plugins/fetchmail/js/fetchmail.js, referer: https://z.advanced-finance.com/webapp/
[Thu Mar 16 16:41:23.788916 2017] [core:info] [pid 23173] [client 127.0.0.1:36075] AH00128: File does not exist: /usr/share/kopano-webapp/plugins/fetchmail/js/fetchmail.js, referer: https://z.advanced-finance.com/webapp/

Obviously by not reading the documentation correctly (and your documentation is very good) I failed to notice that the build was in the builds directory not in the source code.

Will try again, but it is me being stupid.

No problem, happens to the best of us ;-)

now indeed it comes up fine. Thanks a lot!

Question @Kopano

Do you think it would be worth having a common area, sourcecode, packages or whatever where plugins like this are available for all users?

I.e. a central repository where people can go in and search which plugins are available in addition to the official Kopano ones?

@mcostan yes, we have that already on our agenda. As a matter of fact I just added some more links and made it public. You can find it at https://stash.z-hub.io/projects/COM/repos/projects-and-resources/browse

@olia would you be so kind to run through the explained workflow in https://stash.z-hub.io/projects/COM/repos/projects-and-resources/browse/CONTRIBUTING.md and add your project? I am interested if the instructions are clear enough or need to be clarified/simplified. Thanks!

@fbartels
I’ve read the document, and followed it (waiting to hear back for write access to the repo).
Also the instructions are clear enough.

@olia thanks, I just replied to your request.

Hi,
I am not a very skilled Linux user, but i come as far as getting the Fetchmail plugin show up as a plugin. But as soon as i go to the Options in Kopano, i get a Http 500 internal server error as long as the plugin is enabled. So i must be doing something wrong. I’ll try to describe what i have done:

I use a Univention debian distro in a virtual machine. I installed Kopano-core & Kopano-webapp & got that working, including sending mail via a smart relay host.

Installed Requierements ( i think)

  • fetchmail: dpkg -l | grep fetchmail shows it as installed
  • libproc-daemon-perl: installed via apt-get
  • MTA on the host machine (postfix): is working, i can send mail
  • Database to store account informations (At the moment only ‘mysql’ is supported): i did not take specific action on this, i presume Kopano-core install took care of this?

I was able to download, install & activate the plugin; it shows up in the options in kopano-webapp.

I copied the example.config.php in the <kopano-webapp>/plugins/fetchmail folder to config.php ** in the same folder ** and customized the ‘changethis!’ part in define(‘PLUGIN_FETCHMAIL_PASSWORDS_AES_KEY’, “changethis!”)

i did not create a user to run the fetchmail daemon (i found the (default: fetchmail/nogroup) )
i did not Manual: Set the rights for the home directory to 600.
i did not Edit the <kopano-webapp>/plugins/fetchmail/php/daemon/kopano_fetchmail.pl if you used non-standard options.

i Started the daemon with perl kopano_fetchmail.pl --start and no errors where shown.

I still have to create a startup script. (see kopano_fetchmail.service.example for a systemd config).

I did not make any symlinks as previously posted?

Thanks in advance

@pwhooftman said in [New Plugin] Configure and use fetchmail from the WebApp:

Hi,
I am not a very skilled Linux user, but i come as far as getting the Fetchmail plugin show up as a plugin. But as soon as i go to the Options in Kopano, i get a Http 500 internal server error as long as the plugin is enabled. So i must be doing something wrong. I’ll try to describe what i have done:

mmm, it seems i have to do something in the database department after all:
[Mon May 07 11:17:14.629544 2018] [:error] [pid 2652] [client 10.0.0.225:3311] PHP Fatal error: Uncaught Error: Class ’

mysqli’ not found in /usr/share/kopano-webapp/plugins/fetchmail/php/drivers/class.MysqlDatabaseDriver.php:39\nStack trac

e:\n#0 /usr/share/kopano-webapp/plugins/fetchmail/php/class.pluginfetchmailmodule.php(167): MysqlDatabaseDriver->__const

ruct(‘localhost’, ‘3306’, ‘kopano’, ‘kopano_fetchmai…’, ‘kopano_fetchmai…’, ‘password’, ‘********’)\n#1 /usr/shar

e/kopano-webapp/plugins/fetchmail/php/class.pluginfetchmailmodule.php(180): PluginFetchmailModule->getDatabaseConnection

()\n#2 /usr/share/kopano-webapp/plugins/fetchmail/php/class.pluginfetchmailmodule.php(86): PluginFetchmailModule->getLis

tOfFetchmailAccounts()\n#3 /usr/share/kopano-webapp/server/includes/core/class.jsonrequest.php(57): PluginFetchmailModul

e->execute()\n#4 /usr/share/kopano-webapp/kopano.php(137): JSONRequest->execute(’{“zarafa”:{"plu…’)\n#5 {main}\n thro

wn in /usr/share/kopano-webapp/plugins/fetchmail/php/drivers/class.MysqlDatabaseDriver.php on line 39, referer: http://1

0.0.0.168/webapp/

@pwhooftman
Update: i reinstalled phpmyadmin, and now the error states: Cannot connect to database. So, progress :-)

But if i look in phpmyadmin no fetchmail user or table(s) for the plugin are present. Do i have to set up the mysql for the plugin myself (user, tables, etc) , or is that something the daemon should take care of?