Email template 'custom_mail_template' is not defined

You need create file email_templates.xml in etc folder with content:

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Email:etc/email_templates.xsd">
       <template id="custom_mail_template" label=" Your Custom Label" file="yourfile.html" type="html" module="Vendor_YourModule" area="frontend"/>
</config>

This file using declare template have id custom_mail_template in Configuration with path of template file you want use.

After, you create template email file yourfile.html in path Vendor/YourModule/view/frontend/email/yourfile.html

I hope it help for you.