SMTP Email Sender for Workflow Notifications
Send a plain text or HTML email through your own SMTP account from an Apify run. Supports multiple recipients, CC/BCC, Reply-To, and file attachments.
Input schema
Input fields, types, required flags, descriptions, defaults, and prefills come from the published definition. Prefill examples are distinct from defaults.
| Field | Type | Required | Description |
|---|---|---|---|
to | string | required | Recipient email address(es). Separate multiple addresses with commas. Example: 'user@example.com' or 'alice@example.com, bob@example.com' |
cc | string | optional | Carbon copy recipient(s). Separate multiple addresses with commas. |
bcc | string | optional | Blind carbon copy recipient(s). Separate multiple addresses with commas. BCC addresses are hidden from other recipients. |
Show all input fields
| Field | Type | Required | Description |
|---|---|---|---|
to | string | required | Recipient email address(es). Separate multiple addresses with commas. Example: 'user@example.com' or 'alice@example.com, bob@example.com' |
cc | string | optional | Carbon copy recipient(s). Separate multiple addresses with commas. |
bcc | string | optional | Blind carbon copy recipient(s). Separate multiple addresses with commas. BCC addresses are hidden from other recipients. |
subject | string | required | Email subject line. |
text | string | optional | Plain text email body. At least one of 'Plain Text Body' or 'HTML Body' must be provided. If both are set, email clients choose which to display. |
html | string | optional | HTML email body. Takes priority over plain text in most email clients. Example: '<h1>Hello</h1><p>This is a test.</p>' |
replyTo | string | optional | Reply-to email address. When recipients reply, their response goes to this address instead of the sender. |
attachments | array | optional | File attachments as base64-encoded objects. Each item needs 'filename' (string) and 'data' (base64 string). Example: [{"filename": "report.pdf", "data": "base64data..."}] |
smtpHost | string | required | SMTP server hostname. Examples: smtp.gmail.com, smtp.office365.com, smtp.mail.yahoo.com, smtp.mailgun.org, smtp.sendgrid.net |
smtpPort | integer | optional | SMTP server port. Use 587 for STARTTLS (recommended), 465 for SSL/TLS, or 25 for unencrypted. |
smtpUser | string | required | SMTP login username. Usually your full email address. For SendGrid, use 'apikey' as the username. |
smtpPassword | string | required | SMTP login password. For Gmail, use an App Password (Google Account > Security > App Passwords). For SendGrid/Mailgun, use your API key. |
useTls | boolean | optional | Enable TLS encryption. Port 587 uses STARTTLS, port 465 uses direct SSL. Recommended: always keep enabled. |
Download the published input schema
View complete JSON
{
"description": "Send emails via SMTP. Works with Gmail, Outlook, Yahoo, SendGrid, Mailgun, or any SMTP server.",
"properties": {
"attachments": {
"description": "File attachments as base64-encoded objects. Each item needs 'filename' (string) and 'data' (base64 string). Example: [{\"filename\": \"report.pdf\", \"data\": \"base64data...\"}]",
"editor": "json",
"title": "Attachments",
"type": "array"
},
"bcc": {
"description": "Blind carbon copy recipient(s). Separate multiple addresses with commas. BCC addresses are hidden from other recipients.",
"editor": "textfield",
"title": "BCC",
"type": "string"
},
"cc": {
"description": "Carbon copy recipient(s). Separate multiple addresses with commas.",
"editor": "textfield",
"title": "CC",
"type": "string"
},
"html": {
"description": "HTML email body. Takes priority over plain text in most email clients. Example: '<h1>Hello</h1><p>This is a test.</p>'",
"editor": "textarea",
"title": "HTML Body",
"type": "string"
},
"replyTo": {
"description": "Reply-to email address. When recipients reply, their response goes to this address instead of the sender.",
"editor": "textfield",
"title": "Reply-To",
"type": "string"
},
"smtpHost": {
"description": "SMTP server hostname. Examples: smtp.gmail.com, smtp.office365.com, smtp.mail.yahoo.com, smtp.mailgun.org, smtp.sendgrid.net",
"editor": "textfield",
"prefill": "smtp.gmail.com",
"sectionCaption": "SMTP Configuration",
"sectionDescription": "Provide your SMTP server credentials. For Gmail, use an App Password (not your regular password).",
"title": "SMTP Host",
"type": "string"
},
"smtpPassword": {
"description": "SMTP login password. For Gmail, use an App Password (Google Account > Security > App Passwords). For SendGrid/Mailgun, use your API key.",
"editor": "textfield",
"isSecret": true,
"title": "SMTP Password",
"type": "string"
},
"smtpPort": {
"default": 587,
"description": "SMTP server port. Use 587 for STARTTLS (recommended), 465 for SSL/TLS, or 25 for unencrypted.",
"editor": "number",
"maximum": 65535,
"minimum": 1,
"prefill": 587,
"title": "SMTP Port",
"type": "integer"
},
"smtpUser": {
"description": "SMTP login username. Usually your full email address. For SendGrid, use 'apikey' as the username.",
"editor": "textfield",
"title": "SMTP Username",
"type": "string"
},
"subject": {
"description": "Email subject line.",
"editor": "textfield",
"prefill": "Test Email from Apify",
"title": "Subject",
"type": "string"
},
"text": {
"description": "Plain text email body. At least one of 'Plain Text Body' or 'HTML Body' must be provided. If both are set, email clients choose which to display.",
"editor": "textarea",
"title": "Plain Text Body",
"type": "string"
},
"to": {
"description": "Recipient email address(es). Separate multiple addresses with commas. Example: 'user@example.com' or 'alice@example.com, bob@example.com'",
"editor": "textfield",
"prefill": "recipient@example.com",
"sectionCaption": "Email",
"title": "To",
"type": "string"
},
"useTls": {
"default": true,
"description": "Enable TLS encryption. Port 587 uses STARTTLS, port 465 uses direct SSL. Recommended: always keep enabled.",
"editor": "checkbox",
"prefill": true,
"title": "Use TLS/SSL",
"type": "boolean"
}
},
"required": [
"to",
"subject",
"smtpHost",
"smtpUser",
"smtpPassword"
],
"schemaVersion": 1,
"title": "Send Email Input",
"type": "object"
}
Output schema
Published result links and storage locations. This schema is not an exhaustive contract for every field in a dataset record.
| Field | Type | Required | Description |
|---|---|---|---|
results | string | optional | Dataset containing delivery confirmation for each email sent |
Download the published output schema
View complete JSON
{
"actorOutputSchemaVersion": 1,
"description": "Delivery confirmation record for each email sent, including recipients, subject, and the SMTP server used.",
"properties": {
"results": {
"description": "Dataset containing delivery confirmation for each email sent",
"template": "{{links.apiDefaultDatasetUrl}}/items",
"title": "Email Delivery Results",
"type": "string"
}
},
"title": "SMTP Email Sender for Workflow Notifications Output"
}
Dataset schema
Published dataset views and any declared field definitions. A view can select only a subset of the returned record fields.
Download the published dataset schema
View complete JSON
{
"actorSpecification": 1,
"title": "Sent Emails",
"views": {
"overview": {
"display": {
"component": "table",
"properties": {
"sentAt": {
"format": "text",
"label": "Sent At"
},
"sentFrom": {
"format": "text",
"label": "From"
},
"status": {
"format": "text",
"label": "Status"
},
"subject": {
"format": "text",
"label": "Subject"
},
"to": {
"format": "text",
"label": "To"
}
}
},
"title": "Overview",
"transformation": {
"fields": [
"status",
"to",
"subject",
"sentFrom",
"sentAt"
]
}
}
}
}
Key-value schema
Published key-value store definitions, when provided by this build.
This definition is not present in the default published build. See the published README for available documentation.
Published README
Read the full published documentation
SMTP Email Sender for Workflow Notifications
Most scraping and automation pipelines end with "now tell someone." This actor is that last step: point it at your own SMTP account — Gmail, Outlook, Yahoo, SendGrid, Mailgun, Amazon SES, or any other mail server — and it sends one email on your behalf. Trigger it standalone, chain it after another actor finishes, or call it from a webhook so a run's results land in an inbox automatically.
What this actor does
- Sends a single email per run through the SMTP credentials you provide
- Supports plain text, HTML, or both in the same message
- Adds CC, BCC, and Reply-To addresses, with multiple recipients per field
- Attaches files you supply as base64-encoded content
- Sends from the address in
smtpUser, so the SMTP username should be the mailbox you want the email to come from - Reports whether CC, BCC, or a Reply-To address were used, alongside the message's own delivery details
Output per sent email
status— delivery status (sent)to— recipient address(es)cc— CC address(es); an empty string when none were setbcc— BCC address(es); an empty string when none were setsubject— email subject linereplyTo— reply-to address; an empty string when not sethasHtml— whether an HTML body was includedhasText— whether a plain text body was includedattachmentCount— number of attachments supplied inattachments(an entry with invalid or empty data is skipped from the message but still counted here)smtpHost— SMTP server used to send the messagesmtpPort— SMTP port usedsentFrom— sender address (your SMTP username)messageId— the message's Message-ID header; currently an empty string, because the actor doesn't assign one before sendingsentAt— ISO 8601 timestamp of when the message was sent
A record is written only when the SMTP server accepts the message. If validation or sending fails, the run fails with the reason in its status message and the dataset stays empty.
Input
| Field | Type | Default | Description |
|---|---|---|---|
to |
string | – | Recipient address(es), comma-separated. Required. |
cc |
string | – | CC address(es), comma-separated. |
bcc |
string | – | BCC address(es), comma-separated. |
subject |
string | – | Email subject line. Required. |
text |
string | – | Plain text body. At least one of text or html is required. |
html |
string | – | HTML body. At least one of text or html is required. |
replyTo |
string | – | Address replies should go to, if different from the sender. |
attachments |
array | – | Files to attach, each as { "filename": ..., "data": "<base64>" }. |
smtpHost |
string | – | SMTP server hostname (e.g. smtp.gmail.com). Required. |
smtpPort |
integer | 587 |
SMTP server port: 587 for STARTTLS, 465 for direct SSL, or any other port your server uses. |
smtpUser |
string | – | SMTP login username. Required. |
smtpPassword |
string | – | SMTP login password or API key. Required; stored encrypted. |
useTls |
boolean | true |
Encrypt the connection: direct SSL on port 465, STARTTLS on every other port. Turn off only for servers that accept unencrypted connections (e.g. some port 25 relays). |
Example: plain report email via Gmail
{
"to": "team@example.com",
"subject": "Daily scrape complete",
"text": "The nightly run finished with 1,204 new records.",
"smtpHost": "smtp.gmail.com",
"smtpPort": 587,
"smtpUser": "you@gmail.com",
"smtpPassword": "your-app-password",
"useTls": true
}
Example: HTML report with an attachment and CC via Mailgun
{
"to": "alice@example.com, bob@example.com",
"cc": "manager@example.com",
"subject": "Weekly Export",
"html": "<h1>Weekly Export</h1><p>See the attached CSV.</p>",
"attachments": [
{ "filename": "export.csv", "data": "bmFtZSxjb3VudA0KZm9vLDEyMw==" }
],
"smtpHost": "smtp.mailgun.org",
"smtpPort": 587,
"smtpUser": "reports@mg.example.com",
"smtpPassword": "your-mailgun-smtp-password"
}
Example: alert with a custom Reply-To via Outlook / Office 365
{
"to": "oncall@example.com",
"subject": "Threshold exceeded",
"html": "<p>Error rate crossed 5% in the last hour.</p>",
"replyTo": "alerts@example.com",
"smtpHost": "smtp.office365.com",
"smtpPort": 587,
"smtpUser": "monitoring@yourcompany.com",
"smtpPassword": "your-mailbox-password"
}
Use cases
- Run completion alerts — email a summary the moment a scraper or data pipeline finishes
- Scheduled reports — attach a CSV or JSON export and send it on a recurring schedule
- Threshold monitoring — fire an email when a webhook detects a condition worth flagging
- Team notifications — CC or BCC a distribution list whenever a workflow step completes
- Lightweight transactional mail — confirmations, digests, or reminders from a no-code pipeline
FAQ
Which mail providers work with this actor?
Any provider that exposes SMTP, including Gmail, Outlook/Office 365, Yahoo Mail, SendGrid, Mailgun, and Amazon SES. You supply the host, port, username, and password for your own account. Because the From address is always your SMTP username, providers whose username is an email address (Gmail, Outlook, Yahoo, Mailgun) work out of the box. SendGrid (username apikey) and Amazon SES (an access-key style username) will usually reject the message, since that username isn't a verified sender address.
Do I need an app password for Gmail?
Yes, if your Google account has 2-factor authentication enabled (recommended). Generate one under Google Account > Security > App Passwords and use it as smtpPassword.
Can I send to several people at once?
Yes. Put comma-separated addresses in to, cc, or bcc.
Why are cc or replyTo empty in my output record?
Those fields reflect what you set on input — if you didn't supply a CC or Reply-To address, the record carries an empty string for that field rather than omitting it.
Is my SMTP password safe?
smtpPassword is marked as a secret input, so Apify encrypts it at rest and masks it in the console and logs.
How large can an attachment be? This depends on your SMTP provider's own limits (Gmail allows up to 25 MB per message). Keep total attachment size well under that to avoid provider-side rejection.
What if the SMTP server rejects the connection? The run fails with the server's own error message (authentication failure, connection refused, timeout, etc.) so you can correct the host, port, or credentials.
Can I use port 465 instead of 587?
Yes. Set smtpPort to 465 and keep useTls enabled; the actor connects over direct SSL for that port instead of STARTTLS.
Can I choose a different From address or display name?
No. The message is sent from the smtpUser address exactly as entered. Use replyTo if replies should go somewhere else.
Does this actor store or forward my emails anywhere? No. Each run only sends the single message you configure through your own SMTP server; nothing is retained beyond the delivery confirmation record.
Python quickstart
Use a schema-derived input and the Python standard library to start a run. An Apify account and token are required for execution.
Source build mX5wE5AOnSOfsXi8M. Documentation is regenerated from the default published build; private drafts are not included.