Frequently Asked Component Specific Questions

Options

Display all FAQ items

Search FAQ items:


Displaying items 1 to 1 of 1, page 1 of 1

<< previous next >>

TMS Workflow Studio
Sending e-mails

There are several points in the workflow definition where an e-mail can be sent. An example is when a task instance is created for an user. If the task definition properties of this task instance is marked as "Send e-mail notification", an e-mail will be sent to the user notifying him that the task instance was created and assigned to him.

However, there is no built-in code to send e-mails in Workflow Studio. When an e-mail is to be sent, the event OnSendMail of TWorkflowStudio component is fired. So, if you want your workflow so support e-mail sending, create an event handler for TWorkflowStudio.OnSendMail event, and send the e-mail yourself from there, using your own method.

The signature for the OnSendMail event is below:
type
  TEmailInformation = record
        ToAddr: string;
    From: string;
    Bcc: string;
    Cc: string;
    Subject: string;
    Text: string;
  end;

procedure(Sender: TObject; TaskIns: TTaskInstance; AUser: TWorkflowUser;
  AEmailInfo: TEmailInformation; var Sent: boolean) of object;
So, use AEmailInfo parameter to build your e-mail message, using ToAddr, From, Bcc, CC, Subject and Text properties.
Set Sent parameter to true when the e-mail is sent. For extra information (you will often use only AEmailInfo), you can use TaskIns and AUser parameters to know which task instance generated the e-mail, and for each workflow user the e-mail is about to be sent.