phplaravelemailsmtprollbar

How send mail in laravel and RollbarNotifier


I develop a laravel app and I want to automatically send emails with remainder to users.

I created command like in this article. But I get this error:

  [Illuminate\Contracts\Container\BindingResolutionException]
  Unresolvable dependency resolving [Parameter #0 [ <required> $config ]] in
  class RollbarNotifier

This is my code:

.env

MAIL_DRIVER=smtp
MAIL_HOST=example.com
MAIL_PORT=465
MAIL_USERNAME=noreply@example.com
MAIL_PASSWORD=PAssWord
MAIL_ENCRYPTION=SSL

MAIL_FROM_ADDRESS=noreply@example.com
MAIL_FROM_NAME="FROM FROM"

ROLLBAR_TOKEN=<my_token>

config/mail.php

<?php
return [
    'driver' => env('MAIL_DRIVER', 'smtp'),
    'host' => env('MAIL_HOST', 'example.com'),
    'port' => env('MAIL_PORT', 465),

    'from' => [
        'address' => env('MAIL_FROM_ADDRESS', 'noreply@example.com'),
        'name' => env('MAIL_FROM_NAME', 'FROM FROM'),
    ],

    'encryption' => env('MAIL_ENCRYPTION', 'SSL'),
    'username' => env('MAIL_USERNAME'),
    'password' => env('MAIL_PASSWORD'),
    'sendmail' => '/usr/sbin/sendmail -bs',
    'markdown' => [
        'theme' => 'default',

        'paths' => [
            resource_path('views/vendor/mail'),
        ],
    ],    
];

Solution

  • It looks like your dependency injection is not working. It is missing a configuration file.

    I am not sure which package you are using. But when I look at the installation manual at https://github.com/jenssegers/laravel-rollbar I see you also have to add some configuration in the services.php:

    'rollbar' => [
        'access_token' => env('ROLLBAR_TOKEN'),
        'level' => env('ROLLBAR_LEVEL'),
    ],