Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix MailCare Driver #114

Merged
merged 6 commits into from
Apr 3, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions docs/drivers/drivers.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,16 @@ Be sure the check the box labeled "Post the raw, full MIME message." when settin

## MailCare

::: warning
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.
:::

You can then set your `MAILBOX_DRIVER` to "mailcare".

Next you will need to configure MailCare, to send incoming emails to your application at `/laravel-mailbox/mailcare`:
- Activate authentication and automation features.
- Create a new automation with the URL `https://your-application.com/laravel-mailbox/mailcare`
- Be sure the check the box labeled "Post the raw, full MIME message."
Next you will need to configure MailCare, to send incoming emails to your application at `/laravel-mailbox/mailcare`.
- Ask support to activate authentication and automation features.
- 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`
- Be sure the check the box labeled "Post the raw, full MIME message "

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

Expand Down
9 changes: 5 additions & 4 deletions src/Http/Requests/MailCareRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,14 @@ class MailCareRequest extends FormRequest
{
public function validator()
{
return Validator::make($this->all(), [
'email' => 'required',
]);
return Validator::make($this->all(), []);
}
Copy link

@joelharkes joelharkes Mar 24, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
public function validator()
{
return Validator::make($this->all(), [
'email' => 'required',
]);
return Validator::make($this->all(), []);
}
public function rules()
{
return [
"content_type" => "required|in:message/rfc2822",
];
}
public function prepareForValidation()
{
$this->merge([
"content_type" => $this->headers->get("Content-type"),
]);
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks


public function email()
{
return InboundEmail::fromMessage($this->get('email'));
/** @var InboundEmail $modelClass */
$modelClass = config('mailbox.model');

return $modelClass::fromMessage($this->getContent());
}
}