EmailTemplate class
EmailTemplate
Represents an email account.
Parent class
Inherits from object
Constructors
- (int resourceId "The resource id of existing template") - Instanciate an existing template
- (string name "Name of the new template", int parentResourceId "The resource id of existing template") - Create a new template
Methods
- Empty Save() - Save the Email template
- Empty SendTestLinks(int parentResourceId "Which resource to store the emails under", array emails "List of emails to send test mail to", int backupUserResourceId "In case an email doesnt have a user, revert to showing this users info in the mail", EmailAccount from "From address") - Merge emails and send as test
- (From object) string ToString() - The string representation of the object.
Properties
- DateTime CreatedDate { get; } - Get the time of creation.
- string MessageDefaultLanguage { get; set; } - Get/Set the default language mail body.
- DateTime ModifiedDate { get; } - Get the time of last modification.
- string ObjectTypeName { get; } - The name of the type of object.
- int ParentResourceId { get; set; } - Get the resource id.
- int PrimaryKey { get; } - Get the primary id for use in ancient functions.
- int ResourceId { get; } - Get the resource id.
- string ResourceName { get; set; } - Get the resource name.
- string SubjectDefaultLanguage { get; set; } - Get/Set the default language subject.
- (From object) TypeInformation TypeInformation { get; } - Get information about this class.
Static Methods
- array EmailTemplate_getAllFromParent(int parentResourceId "The resource id of existing template") - Find all mail template that are children on the given resource
- Empty EmailTemplate_send(int mailId "Id of mail template", bool isTest "Send as test mail or not", string email "Email address of receiver", string alias "Alias of receiver") - Send mail from current QAS context
- Empty EmailTemplate_send(int mailId "Id of mail template", bool isTest "Send as test mail or not", string email "Email address of receiver", string alias "Alias of receiver", number parentId "Id of resource that contain these mail in communication tab after sending. Set empty to use questionnaire of current QAS context", string from "From email address. Set empty to use default mail of parent", Function custom "A callback function use to override mail content before send. Set empty to ignore") - Send mail
- Empty EmailTemplate_send(int mailId "Id of mail template", bool isTest "Send as test mail or not", string email "Email address of receiver", string alias "Alias of receiver", array ccmails "CC mails, string array", array bccmails "BCC mails, string array", number parentId "Id of resource that contain these mail in communication tab after sending. Set empty to use questionnaire of current QAS context", string from "From email address. Set empty to use default mail of parent", Function custom "A callback function use to override mail content before send. Set empty to ignore") - Send multiple mails. Notice CC/BCC mails are not available if isTest = true
Examples
EmailTemplate email = new EmailTemplate(15537524);
number parentRsId = email.ParentResourceId;
EmailTemplate emailNew = new EmailTemplate("BinhTESTNEW", parentRsId);
emailNew.SubjectDefaultLanguage = "newSub";
emailNew.MessageDefaultLanguage = "Newbody";
emailNew.Save();
Result:
//Ex for using SendTestLinks
EmailTemplate et = new EmailTemplate (15550048);
EmailAccount acc = new EmailAccount("antest");
array toEmails = {
"a1@maysunshine.vn",
"a2@maysunshine.vn",
"a3@maysunshine.vn",
"a4@maysunshine.vn"
};
et.SendTestLinks(15548961, toEmails, 15548957, acc);
//if have no user on system map with the above email address, info of user 15548957 will be shown on the mail