Configure smtp plugin in Jenkins

Manage Jenkins > Configure system > search “E-mail Notification”

gmail smtp server: smtp.gmail.com
port : 587 need TLS

Note: Allow google Less Secure App(should be turned on).

email.Jenkinsfile

pipeline
{
    agent { label 'worker1' }
    stages{
        stage('send-email'){
            
            steps{
                script 
                {
                    emailext subject: 'Test email subject', body: 'Test email body',  to: '[email protected]'
                }
                sh "echo hola"
            }
        }
    }
}