You can create an email template in a test class as we create in any apex class like:
EmailTemplate e = new EmailTemplate (developerName = 'test', FolderId = 'Give Id Of Email Folder', TemplateType= 'Text', Name = 'test'); // plus any other fields that you want to set
insert e;
Best way to create a custom email template is to create visualforce email templates. Please note that you can not sent emails from test calss.
You can create an email template in a test class as we create in any apex class like:
EmailTemplate e = new EmailTemplate (developerName = 'test', FolderId = 'Give Id Of Email Folder', TemplateType= 'Text', Name = 'test'); // plus any other fields that you want to set
insert e;
Best way to create a custom email template is to create visualforce email templates. Please note that you can not sent emails from test calss.
Folder is not optional => folderId = userInfo.getUserId() is the easiest => as explained in the link posted by @Vinita_SFDC http://salesforce.stackexchange.com/questions/12395/how-can-email-template-be-created-in-unit-tests
Hello,
You can create an email template in a test class as we create in any apex class like:
EmailTemplate e = new EmailTemplate (developerName = 'test', FolderId = 'Give Id Of Email Folder', TemplateType= 'Text', Name = 'test'); // plus any other fields that you want to set
All Answers
Hello,
You can create an email template in a test class as we create in any apex class like:
EmailTemplate e = new EmailTemplate (developerName = 'test', FolderId = 'Give Id Of Email Folder', TemplateType= 'Text', Name = 'test'); // plus any other fields that you want to set
Hello,
It is the ID of the folder that contains the template. Probably optional, refer the following link for better example:
http://salesforce.stackexchange.com/questions/12395/how-can-email-template-be-created-in-unit-tests