Is there a good way to clear out the messages in the email queue? We have a ton of garbage messages I would like to just delete.
Best answer by hkabiri
View originalIs there a good way to clear out the messages in the email queue? We have a ton of garbage messages I would like to just delete.
Best answer by hkabiri
View originalYou have two options:
Problem with 1st option is, in case these emails have attached files, the attached files may remain on DB and not deleted.
I think Sam meant option #2 is the one that attached files would remain on the DB (unless a separate SQL query was included for deleting corresponding rows 1st).
I recommend #1 using a keyboard-mouse macro writer (like AutoHotkey).
I believe (still testing/confirming) these 4 scripts will delete emails based on CreatedDate and all associated attachments.
delete UploadFileRevision
from SMEmail
left join NoteDoc
on SMEmail.CompanyID = NoteDoc.CompanyID and
SMEmail.RefNoteID = NoteDoc.NoteID
left join UploadFile
on NoteDoc.CompanyID = UploadFile.CompanyID and
NoteDoc.FileID = UploadFile.FileID
left join UploadFileRevision
on UploadFile.CompanyID = UploadFileRevision.CompanyID and
UploadFile.FileID = UploadFileRevision.FileID
Where SMEmail.CreatedDateTime < '2023/06/01' and
uploadfilerevision.CompanyID is not null
delete UploadFile
from SMEmail
left join NoteDoc
on SMEmail.CompanyID = NoteDoc.CompanyID and
SMEmail.RefNoteID = NoteDoc.NoteID
left join UploadFile
on NoteDoc.CompanyID = UploadFile.CompanyID and
NoteDoc.FileID = UploadFile.FileID
Where SMEmail.CreatedDateTime < '2023/06/01' and
uploadfile.CompanyID is not null
delete NoteDoc
from SMEmail
left join NoteDoc
on SMEmail.CompanyID = NoteDoc.CompanyID and
SMEmail.RefNoteID = NoteDoc.NoteID
Where SMEmail.CreatedDateTime < '2023/06/01' and
notedoc.CompanyID is not null
delete SMEmail
from SMEmail
Where SMEmail.CreatedDateTime < '2023/06/01'
Enter your username or e-mail address. We'll send you an e-mail with instructions to reset your password.