Skip to content

Commit 737b425

Browse files
committed
Updated docs
1 parent 97b5698 commit 737b425

File tree

3 files changed

+36
-2
lines changed

3 files changed

+36
-2
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Shepherd is a lightweight and powerful background processing library for WordPre
99
- **Automatic Retries**: Configurable automatic retries for failed tasks.
1010
- **Debouncing**: Prevent tasks from running too frequently.
1111
- **Logging**: Built-in database logging for task lifecycle events.
12-
- **Included Tasks**: Comes with a ready-to-use `Email` task.
12+
- **Included Tasks**: Comes with ready-to-use tasks including `Email` (with multi-recipient support), `HTTP_Request`, and `Herding` tasks.
1313

1414
## Getting Started
1515

docs/tasks.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ Sends emails asynchronously using WordPress's `wp_mail()` function.
1212

1313
- Automatic retries (up to 4 additional attempts)
1414
- Support for HTML content and attachments
15+
- Support for multiple recipients (comma-separated)
1516
- Comprehensive error handling
1617
- WordPress action hooks for tracking
1718

@@ -20,6 +21,7 @@ Sends emails asynchronously using WordPress's `wp_mail()` function.
2021
```php
2122
use StellarWP\Shepherd\Tasks\Email;
2223

24+
// Single recipient
2325
$email = new Email(
2426
'user@example.com',
2527
'Welcome!',
@@ -28,6 +30,15 @@ $email = new Email(
2830
);
2931

3032
shepherd()->dispatch( $email );
33+
34+
// Multiple recipients
35+
$team_email = new Email(
36+
'user1@example.com, user2@example.com, admin@example.com',
37+
'Team Update',
38+
'Important announcement for the team'
39+
);
40+
41+
shepherd()->dispatch( $team_email );
3142
```
3243

3344
### [HTTP Request Task](./tasks/http-request.md)

docs/tasks/email.md

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public function __construct(
1616

1717
### Parameters
1818

19-
- **`$to_email`** (string, required): Recipient's email address
19+
- **`$to_email`** (string, required): Recipient's email address(es). Can be a single email or multiple comma-separated emails.
2020
- **`$subject`** (string, required): Email subject line
2121
- **`$body`** (string, required): Email body content (HTML or plain text)
2222
- **`$headers`** (array, optional): Email headers (e.g., content type, reply-to)
@@ -65,6 +65,29 @@ $email = new Email(
6565
shepherd()->dispatch( $email );
6666
```
6767

68+
### Email to Multiple Recipients
69+
70+
```php
71+
// Send to multiple recipients
72+
$email = new Email(
73+
'user1@example.com, user2@example.com, admin@example.com',
74+
'Team Update',
75+
'Important update for all team members.'
76+
);
77+
78+
shepherd()->dispatch( $email );
79+
80+
// With proper spacing (whitespace is automatically handled)
81+
$email = new Email(
82+
'user1@example.com,user2@example.com, user3@example.com',
83+
'Newsletter',
84+
'<h1>Weekly Newsletter</h1><p>Here are this week\'s updates...</p>',
85+
[ 'Content-Type: text/html; charset=UTF-8' ]
86+
);
87+
88+
shepherd()->dispatch( $email );
89+
```
90+
6891
### Email with Attachments
6992

7093
```php

0 commit comments

Comments
 (0)