Mail functionality

How to create a mail functionality, can anyone give a example of it ?
And mail should send on button click.

We have the notification_email module which can be used to trigger email notifications based on Trigger.

It is usefull for example for sending an email when an invoice is posted.

Is this what you are searching for?

Here’s a video explaining the notification_email module: