Nextcloud Mail Server

Ultimately asking if itā€™ll be integrated directly into Nextcloud is the wrong approach in my opinion.
Contacts, calendar, LDAP, Spreed - theyā€™re all apps, and none of them are enabled by default.

So, inkeeping with the idea of modularity and shipping a bloat-free solution, thereā€™s no reason someone canā€™t develop an email server app to give the people who want it the opportunity to use it.

Whether that ultimately sees an approach similar to collabora or spreed in running another server to hook into, or someone very clever implements an email server as an app, thereā€™ll be something to point people at.

7 Likes

I used postfix and dovecot for email, and Iā€™m somewhat satisfied. HOWEVER:

I would like email integration, instead of maintaining two separate logins for nextcloud and email. Iā€™d also like to use things like app passwords against email.

What Iā€™d like

  1. Email admin app that takes the functionality of Postfix Admin
  2. login against nextcloud auth
  3. integrated webmail client.(save/send from files), intergration with calendar/contacts
  4. User configuration
  5. web configuration for user sieve rules and spamassassin rules.
  6. administration functions like quotas, finding lost emails, purging old emails, etcā€¦

But Iā€™d like still use dovecot and postfix for the MTA and IMAP daemon, but use a PHP configuration front end, replacing or using something like Postfix Admin.

2 Likes

Having frontend to dovecot, postfix, etc would certainly be nice. But I am afraid, the configuration of the underlying tools varies by linux distributions.

I just spent about two days configuring getmail (fetching mail from gmail and other mail providers), dovecot (imap server + authentication), postfix (SMTP relay back to the mail providers) and I cannot imaging how this could be done and managed in GUI - many tutorials simply did not apply to my install and I had to dig into more details than I originally expected.

Nevertheless, it might be feasible as a self-contained appliance (docker?), where anything would be under control.

P.S. Now I am looking into options of webmail (roundcube) integration with nextcloud, but that is another story. There does not seem to be any fully working solution either.

Iā€™ve been building a full featured IMAP server for a while by now and we hope to start rolling it out for our users in the coming months. Would be great to get it somehow integrated with Nextcloud (besides the obvious IMAP) as it allows to tap into the internals of the server via an HTTP API. All emails are parsed in the server so no need to handle any email RFCs, itā€™s all unicode JSON and binary attachments. https://github.com/nodemailer/wildduck

5 Likes

your project sounds cool. do you know of anyone participating in making it ā€œappā€-ready for nc?

Oh, wildduck certainly does sound cool @andris9 - really nice work! If it were an Nc app it would only require MongoDB, no other new dependencies on the server?

WIldDuck would require Node.js (server application runtime), Redis (counters, pubsub) and MongoDB (actual storage). Itā€™s not PHP so it wouldnā€™t be possible to integrate WildDuck into NextCloud directly (it can not be a NC app as it is a Node.js daemon) but it would be totally possible to control the server via HTTP API from a NC app.

I am also looking for a Roundcube plugin to save/load attachment to/from Nextcloud.
I think using WebDAV is a right way to go. And found an plugin (https://github.com/messagerie-melanie2/Roundcube-Plugin-Roundrive) but it seems that the development of the plugin is stopped.

For the address books CardDAV, Roundcube already have a plugin for it and it works.

@jacky The developer ceased development long ago, citing no support for his work.

As an alternative CardDAV is well supported by Rainloop which is supported on Nextcloud and there is an app in the store for it. Saving attachments to Nextcloud also works well in Rainloop.

FWIW I have a half baked server setup solution for the latest *buntu based servers using plain old bash for install and setup and a simple PHP based standalone interface to manage adding virtual hosts and mailboxes. Iā€™ve just been too busy to polish it off and get it to the point where other folks could use itā€¦ which, ironically, would very much help with said polishing. The PHP frontend is specifically written to able to easily create a plugin for Wordpress so it could work a little like a very very simply cPanel/WHM system from within Wordpress itself and after that I intend to also turn it into a Nextcloud app extension (think MainWP for managing remote Wordpress sites, only for an entire server stack.) The system installs and mostly manages nginx/php-fpm, postfix/dovecot, sieve/spamprobe and powerdns. All services are backed by either MySQL or SQLite so itā€™ll run in a lightly loaded 256MB ram LXD container just fine when using SQLite. The web interface is a mess atm because I am converting it to Bootstrap4 and the setup shell scripts just need to be run through a series of tests to make sure the last few months of tweaks havenā€™t ruined the entire setup flowā€¦ otherwise Iā€™d confidently post a link to the repo.

Hmm, currently one SQLite based DO droplet (512MB ram) is using 170Mb of RSS ram and thatā€™s with a serious 400GB rsync backup currently in progress while still working as a tertiary DNS server. It could easily handle 1/2 dozen active IMAP mailboxes and a dozen static websites (not Wordpress without switching to MySQL.)

To add my 2 cents, I prefer a more generic approach: allow Nextcloud apps to include and run Ansible playbooks.

Once thatā€™s made possible it will be trivial for developers of Nextcloud apps to include playbooks that reconfigure server components like postfix, dovecot, openldap, powerdns, etc. to work with their Nextcloud app.

It also minimizes efforts required from the Nextcloud core developers (allowing them to focus on the core code) while maximizing Nextcloudā€™s potential to include more functionality beyond synchronising files.

Iā€™m using another machine for email, ldap, user account etcā€¦

In my case I use Yunohost for holding email server (postfix) with imap daemon (dovecot) with users integrated through ldap.

The admin interface is quite simple, and ā€¦ by the wayā€¦ it integrates with the machine with nextcloud for user accounts, even with the password. Been easy to change the password from nextcloud, and make it efective for imap server.

Itā€™s not the best solution, but in my case, was the easiestā€¦

Iā€™m looking forward to migrate email, ldap, etc from the yunohost machine to the nextcloud machine. But itā€™s something Iā€™ll do some day. Meanwhile ā€¦ this 2 machines approach itā€™s great to not sacrifice too muchā€¦ and with two virtual machines or two raspberry, you have enough for even a 100 users.

2 Likes

Iā€™ve tried to roll my own linux-based email server in the past (postfix, dovecot, dspam, squirrelmail, etc), and although it all worked, just barely, it had many quirks and it was a nightmare to manage. And I have a 4-year B. Sc. in Computer Science, plus 6 years experience as a Linux Sysadmin! So yah, I strongly vote ā€œdonā€™tā€ (even though we all feel a strong sense of entitlement to ā€œownā€ email just the way weā€™d like). Youā€™ll waste monumental efforts that could be better invested elsewhere (hint: in some successor technology to email).

Free email services like Gmail have spoiled people into expecting the moon from a technology which was never originally architected to have all those bells and whistles, and itā€™s very hard to retrofit them all. Anyone who tries to catch up to a service like Gmail will always be running on a treadmill, as Google, etc. keep raising the bar whenever they like, as they have huge, huge budgets to ā€œjust make it workā€, unlike any Open Source community, which must sluggishly build consensus to get anything done on a larger scale.

I agree that email is critical and will never really go away. But my perspective on email has changed drastically now, which gives me much more sanity. I consider email to just sort of be a ā€œback channelā€, which is used to sign up for services which are somewhat email-like, but much better (in the way of security, and cohesiveness of many smaller services as an entire, comprehensive service, etc.). I virtually never use email to talk to actual humans any longer. Email mostly only helps me sign up for and manage accounts with other messaging services such as Signal and Wire (not to mention my bank, my governments income tax agency, etc). To me, this mere ā€œback channelā€ need not have any place in Nextcloud, which is where actual humans get things done.

This is similar to how many people use their smartphones now. I know people now who donā€™t place actual POTS calls any longer with their smartphones. They instead message with WhatsApp, Signal, Wire, etc. Sure, SMS is still needed, as a ā€œback-channelā€ to signing up to those services (for example, once in a while they want to send you an ā€œactivation codeā€ over SMS). But that conventional POTS cell service is pretty much just a necessary throwback, compared to the thing people really want to use their smartphones for, which is to say, for various internet-based services, over mobile data connection. Iā€™m connecting over cellular right now, to type this, in fact.

A fantastic example is this forum weā€™re all chatting on right here. This forum is web-based. Not email-based. Yet email is how accounts can be ocasionally managed, in a ā€œback-channelā€ sort of way (say, in case you lose your password, and need a reset).

When it comes to email, Iā€™m currently ā€œgetting byā€, by using 1) Protonmail, 2) tutanota.com, another free email service, and 3) a custom linux email server with a hacked-together combination of Qmail + IMAP + Roundcube. And Iā€™ve given up hopes to integrate that with Nextcloud until further notice.

Iā€™m happy enough with this ā€œjust getting byā€ email arrangement for now, which is a protection to my hair turning prematurely grey. Iā€™m patiently waiting for Zulip to mature more, so I can use it in the way that Slack is oftentimes used. Iā€™m optimistic that Zulip, once matured, will become the thing that email wishes it was. Everyone else no doubt has their own favorite technology that they hope will similarily be the sucessor to email (although email will never die entirely, as itā€™s needed to be that necessary ā€œback channelā€).

1 Like

Interestingly enough - I just started using Nextcloud as a replacement for Dropbox/Google drive due to security concerns. Like other posters above, I also had security questions with Gmail and their eavesdropping on everything I do.

I ended up moving my google-apps-hosted domain to a Linux server and Iā€™m using a package called ā€œISPConfigā€ - it is part of a scripted type system that uses all popular linux open source servers (postfix, dovecot, apache/ nginx, pure-ftp, bind) and pieces it all together is a way that makes it much easier that some of the manual installs.

The web interface is based on the concept that YOU are an ISP offering those servcies to clients. However, it very functional for use as your own personal set up as well. It even has the ability to generate free SSL certs and keep them updated for use in all your apps.

Hopefully this will help someone else as I really feel it has met my needs and it works very well with Nextcloud.

Iā€™m looking around to see if there are any decent open source email servers that bundle together several services in an easy-to-install container. IRedMail, which is normally poorly packaged (and will probably lead to ā€œDependency Hellā€), has been turned into a Docker container by some guy on github:

Has anyone tried this, perhaps installed on the same server alongside Nextcloud?

Note that this Docker container bundles in Roundcube, which is going to want to use ports 80 and 443, which Nextcloud will already be using. But I think itā€™s possible to specify nonstandard ports for the built in Roundcube, like ports 88 and 444, so as to not clash with those ports already getting used by Nextcloud on the same server. For example, starting the Docker container with a command a little different than stated in the README.md above (note the use of 88 and 444):

docker run --privileged -p 88:80 -p 444:443 \
       -h HOSTNAME.DOMAIN \
       -e "MYSQL_ROOT_PASSWORD=password" \
       -e "SOGO_WORKERS=1" \
       -e "TZ=Europe/Prague" \
       -e "POSTMASTER_PASSWORD={PLAIN}password" \
       -e "IREDAPD_PLUGINS=['reject_null_sender', 'reject_sender_login_mismatch', 'greylisting', 'throttle', 'amavisd_wblist', 'sql_alias_access_policy']" \
       -v PATH/mysql:/var/lib/mysql \
       -v PATH/vmail:/var/vmail \
       -v PATH/clamav:/var/lib/clamav \
       --name=iredmail lejmr/iredmail:mysql

I took a look at ISPconfig, and appreciated the online demos they offered. ISPconfig looks really, really Enterprise grade; maybe more serious than what Iā€™m looking for. ISPconfig has ā€œFour Access Levels:ā€

  • Administrator
  • Reseller
  • Client
  • Email Login

ā€¦Iā€™m guessing that for a single Nextcloud server, you only really need the ā€œAdministratorā€ access level, and perhaps ā€œEmail Loginā€, while ā€œResellerā€ and ā€œClientā€ might not be needed (as ā€œAdministratorā€ access level seems to be a superset of ā€œResellerā€ and ā€œClientā€ access levels).

@esbeeb - my domain might lead you to believe that I am an ISP. However, that is not the case. I do IT consulting. I set ISPConfig up for my personal services, plus a couple of domains host for myself and a friend. It ā€œmayā€ be overkill, but it works well for me. Best wishes.

I just installed ISPconfig myself, on a cheap VPS where Iā€™m not running Nextcloud. I strongly recommend that you let ISPconfig take full control of a virginally-installed Debian server. ISPconfig is quite ā€œopinionatedā€ (in a very reasonable, sensible way, mind you), but donā€™t assume it will ā€œplay niceā€ with other things youā€™ve already installed on a server, such as Nextcloud (even if Nextcloud is in a snap).

Word to the wise: ISPconfig will work on a server with only 1GB of RAM, but youā€™ll probably want to disable ā€œclamdā€ (as it will consume at least 550MB of RAM!).

Hereā€™s the goodies which I appreciate ISPconfig providing (which act as a compliment to Nextcloudā€™s ā€œMailā€ app):

  • IMAPS
  • SMTPS (SSL-encrypted SMTP submission on port 587)
  • A web admin interface allowing me to create email accounts, as well as set up vacation autoresponse.

Hereā€™s the guide I followed to do my install.

ISPconfig indeed may be overkill for a lot of people. ISPconfig wants to do many other things for you, besides email hosting setup and management (for multiple domains you might own). I wasnā€™t interested in having ISPconfig host services like FTP, XMPP, manage multiple domains/multiple websites for nginx, run my own DNS server (BIND9), etc.

I mentioned above my HCP/SH system for managing web and mail services on lightweight servers and in the last year itā€™s been pretty solid for me. Itā€™s an excellent foundation for Nextcloud on any VPS or LXD container on local hardware. It currently uses Ubuntu 18.04 with nginx/php-fpm and postfix/dovecot/spamprobe. If WordPress is not needed then the entire system can use SQLite which means it will run with less than 256 MB ram and seeing Nextcloud can use SQLite that means a lightly used single user Nextcloud could run in a 200 Mb LXD container on, say, a Kubuntu desktop. A 1GB ram droplet would be fine for Nextcloud with MySQL and WordPress. Not much documentation so feel free to email me for assistance.

You can also use Mailcow dockerized. Itā€™s my Solution for an selfhosted Mailserver.