Hi @Sharma, Sarita ,
Short answer to stop after "Email sent successfully" comment: Use Exit keyword at any line of the script where you wanted to exit from the execution.
To elaborate with illustrations:
Scenario 1 - $outputisrunning variable doesn't exist and using Exit keyword right after "Email sent successfully" comment.
Scenario 2 - $outputisrunning variable doesn't exist and without using Exit keyword right after "Email sent successfully" comment.
Scenario 3 - $outputisrunning variable exist and using Exit keyword right after "Email sent successfully".