1

Topic: Need to delete message in iRedmail

==== Required information ====
- iRedMail version: latest version
- Store mail accounts in which backend (LDAP/MySQL/PGSQL):  Mysql
- Linux/BSD distribution name and version: Ubuntu 12.04
- Related log if you're reporting an issue:
====

I need to know how I be able to delete messages from the server while using mysql backend for iredmail?

2

Re: Need to delete message in iRedmail

Excuse me, delete what messages? Do you mean deleting the whole mailbox while removing mail user account?

Upcoming iRedAdmin-Pro release will log maildir path of deleted user in SQL table, so you can delete mailboxes with a script manually or with a cron job.

You can check the SQL table structure here (table name: deleted_mailboxes), let me know if you want to store more info in this table:
https://bitbucket.org/zhb/iredmail/src/ … ult#cl-283

3

Re: Need to delete message in iRedmail

Ok what I am talking about is deleting one or more messages that is getting stuck and cant download in outlook or any other email client without logging into customers webmail to do this way.  I am not talking about deleting the whole mail box just stuck messages that cant be downloaded or corrupt.

4

Re: Need to delete message in iRedmail

I used to have the very same problem several years ago, it was very annoying... but it vanished long time ago - I think, MS updated outlooks. Easiest is to ask users to update the software.

I usually deleted wrongly formatted emails in filesystem via SSH... it's even not trivial to find out which email is stuck / usually spam.

You have two options how to delete email:
- use IMAP client (e.g. webmail),
- delete it manually in filesystem via SSH,

5

Re: Need to delete message in iRedmail

camel1cz how did you do it via delete in filesystem via SSH?

6

Re: Need to delete message in iRedmail

It's simple... login to the iRedMail server and locate the mailbox in trubles... it's on my system under /home/vmail/vmail1/domain.com/account/Maildir/new or cur...

You can find out the correct location from mysql DB... it's stored in database vmail, table mailbox... attributes storagebasedirectory, storagenode, maildir... then you need to identify somehow the problematic mail under new or cur... note each mail is stored as separate file...

7 (edited by nwohiobb 2013-06-28 04:46:23)

Re: Need to delete message in iRedmail

well mine is setup as : /var/vmail/vmail1/domain.com/   so how would I delete the message of that directory then

8

Re: Need to delete message in iRedmail

I'm not sure if this is what you're looking for but all the actual emails are locate in
/var/vmail/vmail1/<domain>/<username>/Maildir/cur
/var/vmail/vmail1/<domain>/<username>/Maildir/.Drafts
/var/vmail/vmail1/<domain>/<username>/Maildir/.Junk
/var/vmail/vmail1/<domain>/<username>/Maildir/.Junk E-mail
/var/vmail/vmail1/<domain>/<username>/Maildir/new
/var/vmail/vmail1/<domain>/<username>/Maildir/.Sent

ect ect ect...

You'll have a heck of a time finding the emails you want though, especially if you have a lot of emails.
Grep, sed and awk will probably do you some good

9

Re: Need to delete message in iRedmail

yea but I am asking how can you see the messages that you want to delete instead the whole inbox?

10

Re: Need to delete message in iRedmail

If you're running Dovecot-2, try "doveadm search": http://wiki2.dovecot.org/Tools/Doveadm/Search

If you know the mail title/subject or special mail header, you can also find it with "grep". For example:

# cd /var/vmail/xxxxx/cur              # <- go to mailbox folder
# grep -i 'subject you already knew' *             # <- search file content in CURRENT directory. use '-r' option to search current and sub-directories.

NOTE: Sometimes mail body will be encoded, so searching mail body not always work as expected.

11

Re: Need to delete message in iRedmail

Alright after finding the message how do I delete it?

12

Re: Need to delete message in iRedmail

The message is just a plain text file, so, "rm" it.

WARNING: Deleted mail cannot be restored/recovered, do it on your own.

13

Re: Need to delete message in iRedmail

I'm not the OP of this thread, but regarding using rm... does that completely remove the message? Are there any pointers to that email stored in the database?

I need to be able to regularly mass-delete emails from a specific mailbox. I've just created a cron job to delete the files, but is that all I need to do?

14

Re: Need to delete message in iRedmail

Delete the files is enough