I'm writing a logic hook to pre-process emails being imported via the SNIP email archiving feature.
I'm using the before_email_import logic hook but I've also tested it for the more generic before_save logic hook in the emails module.
Basically, I have a condition in the hook to check emails before they are imported and if certain conditions are met, to not import the email. The thing is, I don't want to return an error - I just want it to accept the email and not perform the import into the database.
If I throw an API exception or even just use die(), then sugar's SNIP server receives a non-successful message (I assume from it's behaviour) and retries a few times before giving up.
Due to the amount of emails being processed, I want to avoid importing the emails and having to clean them up afterwards using something like a scheduler. Also, I can't alter what is being sent into the SNIP server and so filter beforehand.
Any suggestions welcome.