Solved

Clear Email Queue

  • 30 June 2022
  • 5 replies
  • 398 views

Userlevel 4
Badge

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. 

icon

Best answer by hkabiri 1 July 2022, 20:52

View original

5 replies

Userlevel 6
Badge +5

@cmoreland 

You have two options:

  1. Delete emails using All Emails Screen and select and click on Trash Can which mark them as Deleted and you may need to redo for Deleted Status emails to completely delete them from UI
  2. Use SQL script and delete from SMEmail Table with condition you specify

Problem with 1st option is, in case these emails have attached files, the attached files may remain on DB and not deleted.

 

 

Badge +1

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).

Userlevel 6
Badge +5

@hkabiri  Hello expert, I happened to find, even if I click twice delete on All emails screen, these records are still kept in DB.  How is that, any suggestion?

 

 

Userlevel 6
Badge +5

@Ahmed  Hello,did you find that even if we click twice on screen, these email data are just mark as deletedrecord=1 and not acutally be cleaned.

Userlevel 2
Badge

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'

Reply


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2024  Acumatica, Inc. All rights reserved