Organization of redirection of the application text to the user's mail

I need to organize the redirection of the text and attachments of the application to the user’s mail under certain conditions, how to do this?

I’m closing / locking this in favor for your earlier thread because this is a duplicate.