[SalesForce] Error when trying to push Lightning EmailTemplates SFDX

I'm trying to push two email templates along with other metadata using SFDX. Here's the folder structure:

force-app\main\default
    applications
    email
        Demo_Email_Templates
            FirstEmail.email
            FirstEmail.email-meta.xml
            SecondEmail.email
            SecondEmail.email-meta.xml
        Demo_Email_Templates.emailFolder-meta.xml
    flexipages

When I try to push my metadata with the Demo_Email_Templates folder I receive the following error:

Error N/A To store the email template in the public folder,
enter the Salesforce organization ID. To store it in a user’s private
folder, enter t that user’s ID.

Error N/A Custom Object Definition ID: bad value for
restricted picklist field: My_Object__c'

Demo_Email_Templates.emailFolder-meta.xml

<?xml version="1.0" encoding="UTF-8"?>
<EmailFolder xmlns="http://soap.sforce.com/2006/04/metadata">
    <accessType>Public</accessType>
    <name>Demo Email Templates</name>
    <publicFolderAccess>ReadWrite</publicFolderAccess>
</EmailFolder>

Meta XML for My_Object__c

<?xml version="1.0" encoding="UTF-8"?>
<EmailTemplate xmlns="http://soap.sforce.com/2006/04/metadata">
    <available>true</available>
    <description>some description</description>
    <encodingKey>ISO-8859-1</encodingKey>
    <name>Notify People</name>
    <relatedEntityType>My_Object__c</relatedEntityType>
    <style>none</style>
    <subject>Revisions are requested on your Concept Note</subject>
    <type>custom</type>
    <uiType>SFX</uiType>
</EmailTemplate>

Email Template for My_Object__c

<html>
 <head> 
  <title></title> 
 </head> 
 <body style="height: auto; min-height: auto;">
  Dear {{{Recipient.Name}}}, 
  <br /> 
  <br /> Dummy Text XYZ {{{My_Object__c.Name}}}. //I tried removing this line as well
  <br /> 
  <br /> Regards, 
  <br /> {{{Sender.Name}}} 
  <ul> 
  </ul>
 </body>
</html>

Do I need to add a setting in the dx JSON definition file? What else am I missing?

Edit: These Email Templates will be packaged (managed package).

Best Answer

i also faced same issue. when ever your EmailTemplate's exist in your custom folder, you need add that folder Developer name also in you package.xml.

in my case test for me as my custom folder, type is Email.

enter image description here

Package.xml

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
 <types>
 <members>test_for_me</members>
 <members>test_for_me/contact_response_Confirmation</members>
 <name>EmailTemplate</name>
</types>
  <version>48.0</version>
</Package>

command:

sfdx force:source:deploy -x ./manifest/package.xml -u mytargetorg
Related Topic