Extending RunBaseBatch
doesn't imply that it is always executed on the server tier - where the code is actually executed depends on where the object lives.
Therefore you could ensure that the code is always executed on the server tier by ensuring that such objects are always created there. To accomplish this just create a server static
method which you use to create new instances of your class.
Example:
public static server Batch_Mailer newOnServer(
str _subject,
str _body,
str _fromName,
str _fromAddress,
str _toAddress)
{
;
return new Batch_Mailer(_subject, _body, _fromName, _fromAddress, _toAddress);
}
After that you just have to call this static method instead of directly using new
:
mail = Batch_Mailer::newOnServer("Subject.", strfmt("@VDX488" ...
mail.run();