responsiv / campaign-plugin

[PREMIUM] Send professional campaign messages to your subscribers.
http://octobercms.com/plugin/responsiv-campaign
5 stars 2 forks source link

Cannot send emails in v1.1.25 #43

Closed Fl0Cri closed 7 years ago

Fl0Cri commented 7 years ago

The error below occurs when trying to send a test mail or when the cron tries to send a campaign. I am using CampaignManager 1.1.25 on October 424. It is working on an other site with CampaignManager 1.1.23 and October419

Symfony\Component\Debug\Exception\FatalThrowableError: Type error: Argument 3 passed to October\Rain\Mail\Mailer::sendTo() must be of the type array, object given, called in /vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php on line 221 in /vendor/october/rain/src/Mail/Mailer.php:105
Stack trace:
#0 /vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(221): October\Rain\Mail\Mailer->sendTo(Object(Responsiv\Campaign\Models\Subscriber), Array, Object(Closure))
#1 /plugins/responsiv/campaign/classes/CampaignManager.php(123): Illuminate\Support\Facades\Facade::__callStatic('sendTo', Array)
#2 /plugins/responsiv/campaign/controllers/Messages.php(190): Responsiv\Campaign\Classes\CampaignManager->sendToSubscriber(Object(Responsiv\Campaign\Models\Message), Object(Responsiv\Campaign\Models\Subscriber))
#3 [internal function]: Responsiv\Campaign\Controllers\Messages->preview_onTest('4')
#4 /modules/backend/classes/Controller.php(532): call_user_func_array(Array, Array)
#5 /modules/backend/classes/Controller.php(423): Backend\Classes\Controller->runAjaxHandler('onTest')
#6 /modules/backend/classes/Controller.php(233): Backend\Classes\Controller->execAjaxHandlers()
#7 /modules/backend/classes/BackendController.php(112): Backend\Classes\Controller->run('preview', Array)
#8 [internal function]: Backend\Classes\BackendController->run('responsiv/campa...')
#9 /vendor/laravel/framework/src/Illuminate/Routing/Controller.php(54): call_user_func_array(Array, Array)
#10 /vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(45): Illuminate\Routing\Controller->callAction('run', Array)
#11 /vendor/laravel/framework/src/Illuminate/Routing/Route.php(205): Illuminate\Routing\ControllerDispatcher->dispatch(Object(Illuminate\Routing\Route), Object(Backend\Classes\BackendController), 'run')
#12 /vendor/laravel/framework/src/Illuminate/Routing/Route.php(162): Illuminate\Routing\Route->runController()
#13 /vendor/laravel/framework/src/Illuminate/Routing/Router.php(610): Illuminate\Routing\Route->run()
#14 /vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(30): Illuminate\Routing\Router->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#15 /vendor/laravel/framework/src/Illuminate/Routing/Middleware/SubstituteBindings.php(41): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#16 /vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(149): Illuminate\Routing\Middleware\SubstituteBindings->handle(Object(Illuminate\Http\Request), Object(Closure))
#17 /vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#18 /vendor/laravel/framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php(49): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#19 /vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(149): Illuminate\View\Middleware\ShareErrorsFromSession->handle(Object(Illuminate\Http\Request), Object(Closure))
#20 /vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#21 /vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(63): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#22 /vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(149): Illuminate\Session\Middleware\StartSession->handle(Object(Illuminate\Http\Request), Object(Closure))
#23 /vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#24 /vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php(37): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#25 /vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(149): Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse->handle(Object(Illuminate\Http\Request), Object(Closure))
#26 /vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#27 /vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php(59): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#28 /vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(149): Illuminate\Cookie\Middleware\EncryptCookies->handle(Object(Illuminate\Http\Request), Object(Closure))
#29 /vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#30 /vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(102): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#31 /vendor/laravel/framework/src/Illuminate/Routing/Router.php(612): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#32 /vendor/laravel/framework/src/Illuminate/Routing/Router.php(571): Illuminate\Routing\Router->runRouteWithinStack(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request))
#33 /vendor/october/rain/src/Router/CoreRouter.php(20): Illuminate\Routing\Router->dispatchToRoute(Object(Illuminate\Http\Request))
#34 /vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(176): October\Rain\Router\CoreRouter->dispatch(Object(Illuminate\Http\Request))
#35 /vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(30): Illuminate\Foundation\Http\Kernel->Illuminate\Foundation\Http\{closure}(Object(Illuminate\Http\Request))
#36 /vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php(46): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#37 /vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(149): Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode->handle(Object(Illuminate\Http\Request), Object(Closure))
#38 /vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#39 /vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(102): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#40 /vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(151): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#41 /vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(116): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter(Object(Illuminate\Http\Request))
#42 /index.php(43): Illuminate\Foundation\Http\Kernel->handle(Object(Illuminate\Http\Request))
#43 {main}

I could solve the problem by replacing the following in /plugins/responsiv/campaign/classes/CampaignManager.php line 117:

Mail::sendTo($subscriber, [

by what it was in v1.1.23

Mail::rawTo($subscriber, [
daftspunk commented 7 years ago

Updated to this and it works

        Mail::rawTo($subscriber, [
            'html' => $html,
            'text' => $text
        ], function($message) use ($campaign) {
            $message->subject($campaign->subject);
        });

Fixed in v1.1.26+