In winter’20 release Salesforce has introduced the new Undo Link on the Delete Record Toast. Now we can undo a deleted record in lightning experience without going to recycle bin.
Using renderStoredEmailTemplate(templateId, whoId, whatId) method of Messaging Class, we can send email to non-contacts using apex. Here is an example to send email to Opportunity owner.
Sample code:
//Send email to opportunity owner
Messaging.SingleEmailMessage mail = Messaging.renderStoredEmailTemplate(emailTemplateId, ownerId, opportunityId);
mail.setTargetObjectId(ownerId);
mail.setSubject(mail.getSubject());
mail.sethtmlBody(mail.gethtmlBody());
mail.saveAsActivity = false;
Messaging.sendEmail(new Messaging.SingleEmailMessage[] {mail});
Set<String> accountNameMatches = new Set<String> { 'A%', 'B%', '%C%', '%D' };
List<Account> accList = [SELECT Id FROM Account WHERE Name LIKE :accountNameMatches];
system.debug('accList-' + accList);