0

I want to allow user to manually enter the subject and body of an email and then send that email using mass email functionality of salesforce. But via mass email i can send email template and can't set its body or subject manualy. Is it possible to insert new email template whenever user wants to send an email and delete it imegiatly after use? Please suggest..

1 Answer 1

0

You can create email template in apex. The supported calls for an email template are as follows: create(), delete(), describeSObjects(), getDeleted(), getUpdated(), query(), retrieve(), update(), upsert().

The fields are: ApiVersion, Body (Type = textarea), BrandTemplateId, Description, DeveloperName, Encoding, FolderId, HtmlValue (Type = textarea), IsActive, LastUsedDate, Markup, Name, NamespacePrefix, OwnerId, Subject, TemplateStyle, TemplateType, and TimesUsed.

String NameVar; // holds name of email template
textarea BodyVar; // holds text body of email template 
Id BrandTmpIdVar; 
//Required - supplies letterhead information for the email template
String DevNmVar;
//This is the Label or Email Template's Unique Name.
Id FldrIdVar;
//ID of the folder that contains the template. Prob optional if you don't need to know this
String Sbjct; // holds subject of the Email Template

// Insert your code here to assign values to the above variables

// Now, create the email template

EmailTemplate e = New EmailTemplate(Name = NameVar, Body = Bodyvar, BrandTemplateId=BrandTmpVar, DeveloperName=DevNmVar, FolderId=FldrIdVar, IsActive=True, Subject=Sbjct, TemplateType=Text) ;

Insert e;

more information you can check here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .