Sage CRM allows you to build email Templates and it offers 3 options for sending out emails. But only one of the options allows an obvious way of using the templates.
This feature of using the templates, on the face of it, is only available to the Internal Mail Client. But if we consider this code:
var myMailObject = eWare.GetBlock("messageblock");
myMailObject.DisplayForm = false;
myMailObject.mSubject = "Subject Here";
myMailObject.mBody = "Message Goes here";
myMailObject.AddRecipient("[email protected]","Training","TO");
myMailObject.Mode = 2; //Set Mode to send(2) message is sent immediately.
Response.Write(myMailObject.Execute());
if (myMailObject.mSentOK)
{
Response.Write("Email Sent")
}
else
{
Response.Write("There has been a problem: "+myMailObject.mErrorMessage);
}
The property myMailObject.mBody could get its text from anywhere. As the template is stored in the database there would be nothing to stop us retrieving the text of the template.
For example
var templateRecord = eWare.FindRecord("emailtemplates","emte_id=1");
myMailObject.mBody = templateRecord.emte_comm_email;
And if we wanted to then we could get clever with searching and replacing the merge characters with contextual information.
- We can use the internal email client which offers us access to the email templates. These are only available via the interface and are tied to the internal email client.
- Send an email using the eWareMessage block, which is typically used in TableLevel scripts and ASP pages. But this can't use the templates
- In the Mail Manager we have the specialised Mail Manager objects but these do not use the template.
This feature of using the templates, on the face of it, is only available to the Internal Mail Client. But if we consider this code:
var myMailObject = eWare.GetBlock("messageblock");
myMailObject.DisplayForm = false;
myMailObject.mSubject = "Subject Here";
myMailObject.mBody = "Message Goes here";
myMailObject.AddRecipient("[email protected]","Training","TO");
myMailObject.Mode = 2; //Set Mode to send(2) message is sent immediately.
Response.Write(myMailObject.Execute());
if (myMailObject.mSentOK)
{
Response.Write("Email Sent")
}
else
{
Response.Write("There has been a problem: "+myMailObject.mErrorMessage);
}
The property myMailObject.mBody could get its text from anywhere. As the template is stored in the database there would be nothing to stop us retrieving the text of the template.
For example
var templateRecord = eWare.FindRecord("emailtemplates","emte_id=1");
myMailObject.mBody = templateRecord.emte_comm_email;
And if we wanted to then we could get clever with searching and replacing the merge characters with contextual information.