Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: DBMail: users

URGENT: Accidentally delete mail user with dbmail-users -d

 

 

DBMail users RSS feed   Index | Next | Previous | View Threaded


blurry1912 at yahoo

Jul 20, 2009, 5:11 AM

Post #1 of 14 (2226 views)
Permalink
URGENT: Accidentally delete mail user with dbmail-users -d

Hi all,

I have a VERY HUGE problem.. I have accidentally deleted a user with the
command

# dbmail-users -d xxxx [at] xxx

Is there any way to restore the user back with all his emails? Please help,
I am in big trouble if this is an irreversible action!

Thanx a million to all for your help!!

Sincerely,
Daniel
--
View this message in context: http://www.nabble.com/URGENT%3A-Accidentally-delete-mail-user-with-dbmail-users--d-tp24568228p24568228.html
Sent from the dbmail users mailing list archive at Nabble.com.

_______________________________________________
DBmail mailing list
DBmail [at] dbmail
http://mailman.fastxs.nl/cgi-bin/mailman/listinfo/dbmail


daniel at gosi

Jul 20, 2009, 5:15 AM

Post #2 of 14 (2155 views)
Permalink
Re: URGENT: Accidentally delete mail user with dbmail-users -d [In reply to]

Hi Daniel,

as long as you do not run dbmail-util the messages are still in the
database.
I guess you can restore them by connecting them to a new/existing user,
but that will require fidling in the database directly.

afaik there is no undelete in dbmail, so, you have to do the "dirty"
work yourself.

btw: what version of dbmail are you running? 2.2 or 2.3?

greetings,
Daniel
_______________________________________________
DBmail mailing list
DBmail [at] dbmail
http://mailman.fastxs.nl/cgi-bin/mailman/listinfo/dbmail


blurry1912 at yahoo

Jul 20, 2009, 5:34 AM

Post #3 of 14 (2153 views)
Permalink
Re: URGENT: Accidentally delete mail user with dbmail-users -d [In reply to]

Hi Daniel!!

Thank you for the reply. Thank God there IS a way to restore the user's
emails! ;))
I am running DBMail 2.2.10, and yes, I can fiddle with the database
directly.

Would you please help me by guiding how to do the "dirty" work of connecting
the messages to a new user? Your help is a life saver!

Thanx man!

Sincerely,
Daniel Mejia



Daniel Urstöger wrote:
>
> Hi Daniel,
>
> as long as you do not run dbmail-util the messages are still in the
> database.
> I guess you can restore them by connecting them to a new/existing user,
> but that will require fidling in the database directly.
>
> afaik there is no undelete in dbmail, so, you have to do the "dirty"
> work yourself.
>
> btw: what version of dbmail are you running? 2.2 or 2.3?
>
> greetings,
> Daniel
>
>

--
View this message in context: http://www.nabble.com/URGENT%3A-Accidentally-delete-mail-user-with-dbmail-users--d-tp24568228p24569008.html
Sent from the dbmail users mailing list archive at Nabble.com.

_______________________________________________
DBmail mailing list
DBmail [at] dbmail
http://mailman.fastxs.nl/cgi-bin/mailman/listinfo/dbmail


daniel at gosi

Jul 20, 2009, 5:41 AM

Post #4 of 14 (2161 views)
Permalink
Re: URGENT: Accidentally delete mail user with dbmail-users -d [In reply to]

Hi Daniel,

well, let´s take a look, do you know which user id the user had you
deleted?
mailbox_idnr would actually be even better, but I guess you have no
clue about that, right?

greetings,
Daniel
_______________________________________________
DBmail mailing list
DBmail [at] dbmail
http://mailman.fastxs.nl/cgi-bin/mailman/listinfo/dbmail


blurry1912 at yahoo

Jul 20, 2009, 5:55 AM

Post #5 of 14 (2147 views)
Permalink
Re: URGENT: Accidentally delete mail user with dbmail-users -d [In reply to]

That is where I got stuck actually. After some tiring search, I got to know
the user_idnr. But the mysql query:

"select * from dbmail_mailboxes where owner_idnr = 'xx';"

returns "Empty set (0.00 sec)" which leads me to think that the mailbox has
been deleted?

By guessing the mailbox_idnr of the user (by looking at users before and
after the deleted user's owner_idnr (xx-1 and xx+1; which returns sequential
numbers from '456-465')); the query:

"select * from dbmail_messages where mailbox_idnr = 'xx-guess';" too returns
"Empty set (0.00 sec)".

FYI, the dbmail-util hasn't been run yet, it is configured in crontab to run
at 12am everyday. Is dbmail-users -d [username] deletes the mailbox and
messages? That should not be the case right? Is there any way that I can
confirm that? Any log files I can look through maybe?

Thanx man.

Sincerely,
Daniel



Daniel Urstöger wrote:
>
> Hi Daniel,
>
> well, let´s take a look, do you know which user id the user had you
> deleted?
> mailbox_idnr would actually be even better, but I guess you have no
> clue about that, right?
>
> greetings,
> Daniel
>
>

--
View this message in context: http://www.nabble.com/URGENT%3A-Accidentally-delete-mail-user-with-dbmail-users--d-tp24568228p24569311.html
Sent from the dbmail users mailing list archive at Nabble.com.

_______________________________________________
DBmail mailing list
DBmail [at] dbmail
http://mailman.fastxs.nl/cgi-bin/mailman/listinfo/dbmail


daniel at gosi

Jul 20, 2009, 6:15 AM

Post #6 of 14 (2151 views)
Permalink
Re: URGENT: Accidentally delete mail user with dbmail-users -d [In reply to]

Hi Daniel,

well the mailboxes also got deleted, I guess, so you can look in the
table
messgages for entries with "deleted_flag" set to 1 and those should be
the messages.

greetings,
Daniel
_______________________________________________
DBmail mailing list
DBmail [at] dbmail
http://mailman.fastxs.nl/cgi-bin/mailman/listinfo/dbmail


blurry1912 at yahoo

Jul 20, 2009, 6:22 AM

Post #7 of 14 (2160 views)
Permalink
Re: URGENT: Accidentally delete mail user with dbmail-users -d [In reply to]

OK, I've found 400+ messages with status = 1. How do I link these messages to
a new mailbox?
Your help is greatly appreciated.

Thanx a million!

Sincerely,
Daniel


Daniel Urstöger wrote:
>
> Hi Daniel,
>
> well the mailboxes also got deleted, I guess, so you can look in the
> table
> messgages for entries with "deleted_flag" set to 1 and those should be
> the messages.
>
> greetings,
> Daniel
>
>

--
View this message in context: http://www.nabble.com/URGENT%3A-Accidentally-delete-mail-user-with-dbmail-users--d-tp24568228p24569771.html
Sent from the dbmail users mailing list archive at Nabble.com.

_______________________________________________
DBmail mailing list
DBmail [at] dbmail
http://mailman.fastxs.nl/cgi-bin/mailman/listinfo/dbmail


daniel at gosi

Jul 20, 2009, 6:24 AM

Post #8 of 14 (2159 views)
Permalink
Re: URGENT: Accidentally delete mail user with dbmail-users -d [In reply to]

Hi there,

well you create a new user, see what mailbox_idnr his INBOX has,
and then you connect the messages with deleted_flag to that mailbox.
After that you set the deleted_flag to 0 and well, there should be
your messages.

greetings,
Daniel
_______________________________________________
DBmail mailing list
DBmail [at] dbmail
http://mailman.fastxs.nl/cgi-bin/mailman/listinfo/dbmail


paul at nfg

Jul 20, 2009, 10:46 AM

Post #9 of 14 (2153 views)
Permalink
Re: URGENT: Accidentally delete mail user with dbmail-users -d [In reply to]

Daniel Mejia wrote:
> Hi all,
>
> I have a VERY HUGE problem.. I have accidentally deleted a user with the
> command
>
> # dbmail-users -d xxxx [at] xxx
>
> Is there any way to restore the user back with all his emails? Please help,
> I am in big trouble if this is an irreversible action!

Oops.

dbmail-users -d username basically doesn't do anything but DELETE FROM
dbmail_users where userid='username', but because of the ways the tables
are setup, this will trigger several cascades.

The main ones that will interest you are:

dbmail_users -> dbmail_mailboxes -> dbmail_messages.

Until you run dbmail-util, the actual messages will still be there: in
dbmail_physmessages and dbmail_messageblks. So do *not* run dbmail-util
until you resolve this. And backup you data!

It should be possible to reconnect all unconnected physmessages to a new
messages and reconnect those to a new mailbox.

create a new user that will contain the rescued messages.
- insert into dbmail_users (userid,passwd) values
('newusername','password');

find the user_idnr:
- select user_idnr from dbmail_users where userid='newusername';
this will give you $newuser_idnr

create a mailbox for this user:
- insert into dbmail_mailboxes (owner_idnr, name, seen_flag,
answered_flag, deleted_flag, flagged_flag, recent_flag, draft_flag)
values ($newuser_idnr, 'INBOX', 1,1,1,1,1,1);

find the mailbox_idnr for this mailbox:

- select mailbox_idnr from dbmail_mailboxes where
owner_idnr=$newuser_idnr and name='INBOX';
this will give you $newuser_inbox_idnr;

Ok, now the real work:

find all unconnected physmessages that may have belonged to the deleted
user.

- select id from dbmail_physmessage p left join dbmail_messages m on
p.id=m.physmessage_id where m.physmessage_id is null;

- for each physmessage.id found thus create a new message:

- insert into dbmail_messages (mailbox_idnr, physmessage_id)
values ($newuser_inbox_idnr, $physmessage_id)

After this you should be able to login to dbmail-imap with the newuser's
id and password and see the messages.

But like I said, this will *only* work if you haven't run dbmail-util
since the accidental deletion.


>
> Thanx a million to all for your help!!
>
> Sincerely,
> Daniel


--
________________________________________________________________
Paul Stevens paul at nfg.nl
NET FACILITIES GROUP GPG/PGP: 1024D/11F8CD31
The Netherlands________________________________http://www.nfg.nl
_______________________________________________
DBmail mailing list
DBmail [at] dbmail
http://mailman.fastxs.nl/cgi-bin/mailman/listinfo/dbmail


vulture at netvulture

Jul 20, 2009, 2:40 PM

Post #10 of 14 (2145 views)
Permalink
Re: URGENT: Accidentally delete mail user with dbmail-users -d [In reply to]

Perhaps we should have a status column on dbmail_users like we have on
messages.

0 = disabled
1 = enabled
2 = deleted
3 = purge ok


Then on the dbmail-util run it will moved deleted to purge - then
really delete the purge like we do with messages.

-Jon

--
Scanned for viruses and dangerous content by MailScanner

_______________________________________________
DBmail mailing list
DBmail [at] dbmail
http://mailman.fastxs.nl/cgi-bin/mailman/listinfo/dbmail


rcsheets at picosecond

Jul 21, 2009, 1:35 PM

Post #11 of 14 (2140 views)
Permalink
Re: URGENT: Accidentally delete mail user with dbmail-users -d [In reply to]

On 7/20/2009 5:40 PM, Jonathan Feally wrote:
> Perhaps we should have a status column on dbmail_users like we have on
> messages.
>
> 0 = disabled
> 1 = enabled
> 2 = deleted
> 3 = purge ok
>
>
> Then on the dbmail-util run it will moved deleted to purge - then
> really delete the purge like we do with messages.

I like this idea a lot. Are there any great reasons not to do this?
--
Robert C. Sheets
Picosecond Software
_______________________________________________
DBmail mailing list
DBmail [at] dbmail
http://mailman.fastxs.nl/cgi-bin/mailman/listinfo/dbmail


mysql.jorge at decimal

Jul 21, 2009, 2:18 PM

Post #12 of 14 (2131 views)
Permalink
Re: URGENT: Accidentally delete mail user with dbmail-users -d [In reply to]

> On 7/20/2009 5:40 PM, Jonathan Feally wrote:
> > Perhaps we should have a status column on dbmail_users like we have
> on
> > messages.
> >
> > 0 = disabled
> > 1 = enabled
> > 2 = deleted
> > 3 = purge ok
> >
> >
> > Then on the dbmail-util run it will moved deleted to purge - then
> > really delete the purge like we do with messages.
>
> I like this idea a lot. Are there any great reasons not to do this?

That's interesting.
That may need a big change on dbmail-util only I think.

_______________________________________________
DBmail mailing list
DBmail [at] dbmail
http://mailman.fastxs.nl/cgi-bin/mailman/listinfo/dbmail


blurry1912 at yahoo

Jul 21, 2009, 8:06 PM

Post #13 of 14 (2145 views)
Permalink
Re: URGENT: Accidentally delete mail user with dbmail-users -d [In reply to]

Paul J Stevens wrote:
>
> Ok, now the real work:
>
> find all unconnected physmessages that may have belonged to the deleted
> user.
>
> - select id from dbmail_physmessage p left join dbmail_messages m on
> p.id=m.physmessage_id where m.physmessage_id is null;
>
> - for each physmessage.id found thus create a new message:
>
> - insert into dbmail_messages (mailbox_idnr, physmessage_id)
> values ($newuser_inbox_idnr, $physmessage_id)
>
Thank you Paul for you help.

By following your guide, and a little bit of PHP, I managed to salvage the
messages from the ashes and behold, the emails. :p

I like the idea of statuses for users, where dmail-users -d does not delete
the user directly, but will be deleted by dbmail-util later. Great for cases
of accidental deletion that have happened to me. Thanx guys for helping me
out. ;)

Regards,
Daniel
--
View this message in context: http://www.nabble.com/URGENT%3A-Accidentally-delete-mail-user-with-dbmail-users--d-tp24568228p24599349.html
Sent from the dbmail users mailing list archive at Nabble.com.

_______________________________________________
DBmail mailing list
DBmail [at] dbmail
http://mailman.fastxs.nl/cgi-bin/mailman/listinfo/dbmail


michael.monnerie at is

Jul 21, 2009, 11:22 PM

Post #14 of 14 (2131 views)
Permalink
Re: URGENT: Accidentally delete mail user with dbmail-users -d [In reply to]

On Montag 20 Juli 2009 Jonathan Feally wrote:
> Perhaps we should have a status column on dbmail_users like we have
> on messages.
>
> 0 = disabled
> 1 = enabled
> 2 = deleted
> 3 = purge ok
>
>
> Then on the dbmail-util run it will moved deleted to purge  - then
> really delete the purge like we do with messages.

+1 for the feature. We've adopted dbmail 2.2, and just have an "active"
flag for the user, and your idea is even better.

Can we have the same flag on aliases too?

And please, if a user/alias is status=0 (disabled), dbmail should do as
if it doesn't exist. No delivery/forwarding etc.

mfg zmi
--
// Michael Monnerie, Ing.BSc ----- http://it-management.at
// Tel: 0660 / 415 65 31 .network.your.ideas.
// PGP Key: "curl -s http://zmi.at/zmi.asc | gpg --import"
// Fingerprint: AC19 F9D5 36ED CD8A EF38 500E CE14 91F7 1C12 09B4
// Keyserver: wwwkeys.eu.pgp.net Key-ID: 1C1209B4
Attachments: signature.asc (0.19 KB)

DBMail users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.