Skip to content

Commit 9c62eed

Browse files
authored
Merge pull request #114 from mailcare/fix-mailcare-driver
Fix MailCare Driver
2 parents a3902cf + 4404e66 commit 9c62eed

File tree

2 files changed

+22
-9
lines changed

2 files changed

+22
-9
lines changed

docs/drivers/drivers.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,16 @@ Be sure the check the box labeled "Post the raw, full MIME message." when settin
5353

5454
## MailCare
5555

56+
::: warning
57+
To use MailCare with Laravel Mailbox, you will need to generate a random password and store it as the `MAILBOX_HTTP_PASSWORD` environment variable. The default username is "laravel-mailbox", but you can change it using the `MAILBOX_HTTP_USERNAME` environment variable.
58+
:::
59+
5660
You can then set your `MAILBOX_DRIVER` to "mailcare".
5761

58-
Next you will need to configure MailCare, to send incoming emails to your application at `/laravel-mailbox/mailcare`:
59-
- Activate authentication and automation features.
60-
- Create a new automation with the URL `https://your-application.com/laravel-mailbox/mailcare`
61-
- Be sure the check the box labeled "Post the raw, full MIME message."
62+
Next you will need to configure MailCare, to send incoming emails to your application at `/laravel-mailbox/mailcare`.
63+
- Ask support to activate authentication and automation features.
64+
- Create a new automation, if your application is at `https://awesome-laravel.com`, it would be with the URL `https://MAILBOX_HTTP_USERNAME:MAILBOX_HTTP_PASSWORD@awesome-laravel.com/laravel-mailbox/mailcare`
65+
- Be sure the check the box labeled "Post the raw, full MIME message "
6266

6367
See ["MailCare"](https://mailcare.io) for more information.
6468

src/Http/Requests/MailCareRequest.php

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,28 @@
44

55
use BeyondCode\Mailbox\InboundEmail;
66
use Illuminate\Foundation\Http\FormRequest;
7-
use Illuminate\Support\Facades\Validator;
87

98
class MailCareRequest extends FormRequest
109
{
11-
public function validator()
10+
public function rules()
1211
{
13-
return Validator::make($this->all(), [
14-
'email' => 'required',
12+
return [
13+
'content_type' => 'required|in:message/rfc2822',
14+
];
15+
}
16+
17+
public function prepareForValidation()
18+
{
19+
$this->merge([
20+
'content_type' => $this->headers->get('Content-type'),
1521
]);
1622
}
1723

1824
public function email()
1925
{
20-
return InboundEmail::fromMessage($this->get('email'));
26+
/** @var InboundEmail $modelClass */
27+
$modelClass = config('mailbox.model');
28+
29+
return $modelClass::fromMessage($this->getContent());
2130
}
2231
}

0 commit comments

Comments
 (0)