Call us on : +44 (0)118 303 0100
Placeholder

Customer Forum

Sending email via the API

Workbooks Support Posted: 2012-03-09 15:02

With the Workbooks Process Engine it is easy to send an email.

The API accepts emails to send in the standard format for an email.  All you need to do is to pass in the whole email as a parameter called 'rfc822' along with 'status=SEND' and call the create email API. This is very powerful: the email can be pretty much anything; attachments work as you would expect and the created email is linked to related records within Workbooks as you would expect.

The email is delivered according to your Workbooks Email Configuration.

To send the email you simply need code in your Workbooks Script like this: 

$create_email = array (
        'rfc822'   => "From: sender@mydomain.com\n" .
                      "To: recipient@otherdomain.com\n" .
                      "Subject: Hello Email World!\n" .
                      "Content-Type: text/plain; charset=iso-8859-1\n" .
                      "\n" .
                      "Here is the text body of the email.\n",
        'status'   => 'SEND',
);
$workbooks->assertCreate('email/emails', $create_email);
Workbooks Support Posted: Tue, 18.01.2011 - 18:21

When adding a recipient in this way, Workbooks only brings up a list of those people whose record includes an email address so it sounds like this field is empty on the record you're trying to access.  If you know it, you can type in the person's email address instead of the recipient name however, we'd recommend that you complete the email field in the person record so this problem doesn't recur and so that outgoing emails are shown against the person's record.