This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.
Refineria
Hello,
While working with standard SMTP email send I found this error: "Argument #1 ($message) must be of type Illuminate\Mail\SentMessage, Illuminate\Mail\Message given"
Code:
Mail::send('ivan.ivanblog::contact.template', [], function ($message) {
$message->to('xxx@example.com', 'Admin Person');
$message->subject('subject');
});
Debugging I saw that this line of code:
vendor/october/rain/src/Mail/Mailer.php
(Line 121)
// vendor/october/rain/src/Mail/Mailer.php (Line 121)
$this->dispatchSentEvent($message, $data);
Generate that exception because $message
is type Illuminate\Mail\Message
, and that function need a type Illuminate\Mail\SentMessage
.
vendor/laravel/framework/src/Illuminate/Mail/Mailer.php
(Line 522)
// vendor/laravel/framework/src/Illuminate/Mail/Mailer.php (Line 522)
/**
* Dispatch the message sent event.
*
* @param \Illuminate\Mail\SentMessage $message
* @param array $data
* @return void
*/
protected function dispatchSentEvent($message, $data = [])
{
if ($this->events) {
$this->events->dispatch(
new MessageSent($message, $data)
);
}
}
Thanks
1-3 of 3