Outlook Send Email
Outlook Send Email
Section titled “Outlook Send Email”Type: outlook-send · Package: Outlook Activities v1.0.5
Sends an email through Outlook. It supports several recipients, carbon copy (CC) and blind carbon copy (BCC), plain-text or HTML body, and attachments. Useful for notifications, reports, confirmations. Since it uses the account configured in Outlook, you need no server or password in the playbook, and the email is kept in Sent Items.
How it works
Section titled “How it works”It composes the email and sends it right away:
- Account: if there is an Outlook Connect session with
accountand that account exists in the profile, the email goes out from it; otherwise, from the default account. - Recipients:
to,ccandbccaccept a text with the addresses separated by semicolons (;) or commas, or a list of addresses (since version 1.0.5; before, a list made the send fail). Outlook resolves each entry as if you had typed it (address or address-book name). - Body: if you set
htmlBody, it is used andbodyis ignored. If you set neither, the email has no body. - Attachments: paths that do not exist on disk are skipped (the log says how many) and the email is sent anyway.
Required parameters
Section titled “Required parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
to | string | List | — | Recipient(s): text separated by ; or ,, or a list of addresses (list since version 1.0.5). |
subject | string | — | Email subject. |
Optional parameters
Section titled “Optional parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
session | ZoanOutlookSession | — | Session from Outlook Connect. Inherited inside the Connect body; without a session the default account is used. |
cc | string | List | — | CC recipients: text separated by ; or ,, or a list. |
bcc | string | List | — | BCC recipients: text separated by ; or ,, or a list. |
body | string | — | Plain-text body. |
htmlBody | string | — | HTML body. When set, it takes precedence over body. |
attachments | string | List | — | Path of a local file or list of paths to attach. Empty or missing paths are skipped. |
Output
Section titled “Output”This activity does not return a value. The log says how many recipients the email was sent to.
Common errors
Section titled “Common errors”| Message | Cause and fix |
|---|---|
'to' is required. | to is missing or the expression returned null. |
| Outlook error when resolving recipients | An entry in to/cc/bcc is neither a valid address nor an address-book name. Check the text and the separator (;). |
| Outlook error when sending | Offline, account without send permission, or attachment blocked by size or type. Check Outlook on the robot’s machine. |
COM component 'Outlook.Application' is not registered. Is the application installed? | Outlook is not installed on the robot’s machine. |
Example
Section titled “Example”Email with the invoice attached:
Outlook Send Email to = "customer@company.com" subject = "Invoice " + invoiceNumber body = "Please find your invoice attached. Thank you." attachments = arr("C:/invoices/" + invoiceNumber + ".pdf")HTML email with CC, from a list of recipients:
Outlook Send Email to = recipients cc = "supervisor@company.com" subject = "Daily report" htmlBody = "<h1>Report</h1><p>Processed: " + total + "</p>"Related activities
Section titled “Related activities”- Outlook Reply — reply to an existing email.
- Outlook Get Emails — read emails.
- SMTP Send — send without Outlook installed.