How to fully remove and reinstall the mail app?

In the past I’ve once tried out the mail app and disabled it after some testing because it didn’t work as expected.
Today I reactivated the app and directly ran into an error condition, mainly because of wrong legacy configuration fragments. I completely remove the app, dropped all mail related tables and reinstalled it to start from scratch.
Unfortunately the required database tables haven’t been recreated so that it runs into an error condition again. Can someone please tell me how I can fully reset the app to start from scratch? The administrator guide didn’t cover this important question and also the forum search function couldn’t answer it.

1 Like

I’ve fiddled-out what I had missed. I had to execute the following commands to remove legacy app fragments from the database to be able to reinstall the app:

DELETE FROM `prefix_migrations` WHERE app='mail';
DELETE FROM `prefix_preferences` WHERE appid='mail';
1 Like

Hi,

as a Mail app dev I’m curious to hear what motivates you to delete all app data? We’ve had migrations for a while and I couldn’t think of a reason for dropping the tables as the next time you’ll install the app you get the exact same schema.

Cheers

@ChristophWurst The problem is, that the mail app has never worked with my specific UW-IMAP based setup. I wanted to start from scratch and give it a try again. Unfortunately the app still has problems with my email account and runs into a timeout every time I try to access my mailbox, whereas Thunderbird, Roundcube and many other applications are working well.

Gateway Timeout

The gateway did not receive a timely response from the upstream server or application.

UW-IMAP uses a big file in Mbox format for all emails. Such email server are very slow.
Perhaps that explains the timeout you get.
Check the admin readme to increase the timeout limit https://github.com/nextcloud/mail/blob/master/doc/admin.md#timeouts.

I will give it a try but I’m not really confident that it solves the problem. As I wrote, other programs, like Roundcube, doesn’t have any problems accessing a mailbox within seconds. The Nextcloud mail app directly hangs after it has been selected with a spinning circle being displayed. I’ve not even a chance to change any setting etc. without removing and reinstalling the app - that’s really weired.

@ChristophWurst Could you please tell me if a debug guide exists for the mail app? Today I’ve reactivated the app and checked the Nextcloud log file for related messages. This is what I found and might be of importance:

...,"app":"index","method":"GET","url":"\/index.php\/apps\/mail\/","message":{"Exception":"TypeError","Message":"explode() expects parameter 1 to be string, null given","Code":0,"Trace":[{"file":"\/srv\/www\/nextcloud\/nextcloud\/apps2\/mail\/lib\/IMAP\/FolderMapper.php","line":219,"function":"explode","args":[null,"INBOX",2]},{"file":"\/srv\/www\/nextcloud\/nextcloud\/apps2\/mail\/lib\/IMAP\/FolderMapper.php","line":200,"function":"guessSpecialUse","class":"OCA\\Mail\\IMAP\\FolderMapper","type":"->","args":[{"__class__":"OCA\\Mail\\Folder"}]},{"file":"\/srv\/www\/nextcloud\/nextcloud\/apps2\/mail\/lib\/IMAP\/FolderMapper.php","line":158,"function":"detectSpecialUse","class":"OCA\\Mail\\IMAP\\FolderMapper","type":"->","args":[{"__class__":"OCA\\Mail\\Folder"}]},{"file":"\/srv\/www\/nextcloud\/nextcloud\/apps2\/mail\/lib\/IMAP\/MailboxSync.php","line":79,"function":"detectFolderSpecialUse","class":"OCA\\Mail\\IMAP\\FolderMapper","type":"->","args":[[{"__class__":"OCA\\Mail\\Folder"},{"__class__":"OCA\\Mail\\Folder"},{"__class__":"OCA\\Mail\\Folder"},{"__class__":"OCA\\Mail\\Folder"},{"__class__":"OCA\\Mail\\Folder"},{"__class__":"OCA\\Mail\\Folder"},{"__class__":"OCA\\Mail\\Folder"},{"__class__":"OCA\\Mail\\Folder"},{"__class__":"OCA\\Mail\\Folder"},{"__class__":"OCA\\Mail\\Folder"},{"__class__":"OCA\\Mail\\Folder"},{"__class__":"OCA\\Mail\\Folder"},{"__class__":"OCA\\Mail\\Folder"},{"__class__":"OCA\\Mail\\Folder"},{"__class__":"OCA\\Mail\\Folder"},{"__class__":"OCA\\Mail\\Folder"},{"__class__":"OCA\\Mail\\Folder"},{"__class__":"OCA\\Mail\\Folder"},{"__class__":"OCA\\Mail\\Folder"},{"__class__":"OCA\\Mail\\Folder"},{"__class__":"OCA\\Mail\\Folder"},{"__class__":"OCA\\Mail\\Folder"},{"__class__":"OCA\\Mail\\Folder"}, ...

I just upgraded from 15 to 16 and then to 17 and had auto mail accounts app enabled.

All my mail accounts [and my users’ mail accounts] are now wrongly configured, i can remove all except for the email account matching the logged in user on NC. I am trying to wipe the db because even after disabling and removing both apps, removing auto mail accounts config from config.php, and truncating all tables starting with mail_, i still have the old non-functional accounts.

@j-ed in what table did you run these commands?

thanks

If prefix=oc_ then

prefix_migrations   -> oc_migrations
prefix_preferences  -> oc_preferences

oh, now i get it, thanks!

I really don’t understand, I have done:

DELETE FROM `oc_migrations` WHERE app='mail';
DELETE FROM `oc_preferences` WHERE appid='mail';

drop table oc_mail_accounts;
drop table oc_mail_attachments;
drop table oc_mail_aliases;
drop table oc_mail_coll_addresses;
drop table oc_mail_mailboxes;

and still when I re-download and enable the mail app this is what i see:

and no way to delete it or change its settings.

Originally before i upgraded to 17 i had auto mail accounts installed, but now it is removed and its config removed from config.php

How do i completely erase this account?

Go to your admin settings. In collaboration you’ll find the provisioning settings.

ok, that worked thanks. i had no idea such section existed. does this section replace the functionality provided by auto mail accounts app?

thanks

absolutely. it’s the v2.0 if you want to see it like that https://github.com/nextcloud/mail/releases/tag/v0.20.0 :slight_smile:

great thanks!

@ChristophWurst actually everything works except for the STARTTLS setting outbound.

I have set everything under index.php/settings/admin/groupware and when re-opening this admin page settings are stored.

Then any new user logs in, they have their own account pre-provisioned. All fine until here.

Then user a@ wants to provision accounting@ on the same domain and same server. They choose automatic provisioning, enter password, account shows up, mail flows in, all is good. Until they try to send, then they get error 500.

So I log into their NC account, go into their mail app, then open the settings for accounting@, I’m now in: index.php/apps/mail/#/accounts/101/settings

Under this, settings have changed to manual, and all boxes are filled in except for STARTTLS: none of the options are blue, neither NONE, nor SSL, nor STARTTLS.

Both password fields are empty and red-bordered, but i assume that to be normal.

So when I select STARTTLS manually from there, then mails go out too.

So I think there’s an issue in provisioning.

Thanks

Please start a new topic.

Thanks man. I opened up phpmyadmin on my shared host and ran these commands, further tables were flagged and promptly dropped as well, until the Mail app was able to install. First time the Mail app has actually worked on my install, ever.