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 Web
Refineria Web

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

daftspunky
daftspunky

Hi,

Try updating to the latest patch version and it should help.

Refineria Web
Refineria Web

Hi,

Thanks for your advice, just updated to version 3.0.20 and its working.

1-3 of 3

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.