As a starting point you can see the work-.SendSimpleEmail activity, any email sent from case will be attached to the corresponding case. The contents of email (i.e. correspondence) will be save to the table “PR_DATA_CORR_EMAIL” (Data-Corr-Email class) but not as part of case and the connection is established to case and attachment via “Link-Attachment” class.
You can queue the correspondence through “Queue-For-Agent” method. Based on maximum number of attempts configured, agent activity will process the queued item and the item will move to “Broken-Process” status if all the attempts are failed.
2. Will the row be deleted once the email is delivered?
When you queue an item, a new row added to “System-Queue-DefaultEntry” class (pegadata.pr_sys_queues table), on successful processing the item will be deleted from pegadata.pr_sys_queues table but not PR_DATA_CORR_EMAIL table.
3. How to check if the email delivery has failed or is it still waiting?
In the agent activity, you can set the status (success / fail) to a property on successful / failure processing.