I want to know when is the email notification sent during saving a CRED form.
I want to take an action AFTER the email is sent with custom field data. So I need to know which hook can I use to do that. Is there a hook at fires after notifications are sent?
Form notifications will have been enqueued by then, but the actual process of sending is tied to WP shutting down, and there isn't a hook available after the notifications have actually been sent.
Sending is via the core function wp_mail, and I checked the source code for that, and it doesn't provide an action after the messages have been sent either.
The email will be written before being sent. If you have changed the data between the moment where the email has been enqueued, and the moment it is being sent, the email will contain the last data to be saved.
I still do not understand the full sequence. Thank you for your patience. Let me try one more time -
1) I want to edit a post with a form with custom fields including a message field.
2) Use data submitted in the form to send an email. The email would also contain the message field.
3) When the email is sent, I want to delete the data in the message field of the post. This way, the user receives the message via email notification.
4) Now when the author decides to edit the post again, they don't see the previous message and can send a new message on submitting the form.
Can this be done in the toolset with the message field data being deleted after the email is sent with the message data? If yes, how?