You need to sign in to do that
Don't have an account?

HTML Email template (with letterhead) using in triggers
I created an email alert in a trigger.it's not displaying images(custom html).how could i send email alert with HTML template with letter head.I dont think it doesn't support.is it? below is my code.
EmailTemplate template=[SELECT HtmlValue,Body FROM EmailTemplate WHERE Name='SpamCatchTest1']; //custom html )(without letterhead)template if(newCase.Origin =='Email' && newCase.SuppliedEmail !=null ) { String hbody=''; String plainTxtBody=''; hbody=template.HtmlValue; hbody=hbody.replace('{!Contact.Name}',k); plainTxtBody=template.Body; List<Messaging.SingleEmailMessage> mails = new List<Messaging.SingleEmailMessage>(); Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage(); List<String> sendTo = new List<String>(); sendTo.add(newCase.SuppliedEmail ); System.debug(newCase.SuppliedEmail); mail.setToAddresses(sendTo); OrgWideEmailAddress[] owea = [select Id from OrgWideEmailAddress where Address = 'portal.support@nexenta.com']; //mail.setReplyTo('portal.support@xxx.com'); List<String> ccTo = new List<String>(); ccTo.add('satheesh.thondamanti@xxx.com'); mail.setCcAddresses(ccTo); mail.setTemplateID(template.Id);//This is the template you are setting mail.setSubject('Email to Case Response'); //String body = 'Dear ' + Contact.FirstName + Contact.LastName + ', '; //body += 'Thank you for your email. Your support request cannot be processed at the moment. Support is available only for Nexenta customers who has valid support contract.For any queries on your community edition, please go to and post your query. If you have valid support contract, please get in touch with your Nexenta sales team with purchase details to get access to Nexenta support portal.'; mail.setOrgWideEmailAddressId(owea.get(0).Id); mail.setHtmlBody(hbody); // mail.setPlainTextBody(plainTxtBody); // mail.setTreatTargetObjectAsRecipient(true); mails.add(mail); System.debug(mail); Messaging.sendEmail(mails); //Messaging.SendEmailResult[] results = Messaging.sendEmail(messages); }
Thanks for quick reply. Is it HTML template with letterhead? or custom HTML??