skip to Main Content

I have an error when try to send mail to mailhog with laravel, is the follow:

The "" scheme is not supported; supported schemes for mailer "smtp" are: "smtp", "smtps".

Env file config:

MAIL_MAILER=smtp    
MAIL_HOST=localhost    
MAIL_PORT=1025    
MAIL_USERNAME=null    
MAIL_PASSWORD=null    
MAIL_ENCRYPTION=null    
MAIL_FROM_ADDRESS="[email protected]"    
MAIL_FROM_NAME="${APP_NAME}" 

my route code:

Route::get('/email', function () {

    Mail::raw('Mensagem de teste de RH MANAGMENT', function (Message $message) {
        $message->to('[email protected]')->subject('Recursos Humanos RH')->from('[email protected]');
    });

});

Could soemone help me?

2

Answers


  1. It seems like a relatively new issue: https://github.com/laravel/framework/issues/53721

    Which should be fixed in the next release.

    In the meantime, you should manually upgrade the symfony/mailer package.

    composer require "symfony/mailer:~7.1.0"
    

    If the issue persists try changing the MAIL_ENCRYPTION which should automatically set the scheme:

    MAIL_ENCRYPTION=tls
    

    As discussed in the issue: https://github.com/laravel/framework/issues/53721#issuecomment-2513369358

    Login or Signup to reply.
  2. In my case a hint from Laracast forum solved it.

    https://laracasts.com/discuss/channels/laravel/mailer-problem-scheme-is-not-supported-supported-schemes-for-mailer-smtp-are-smtp-smtps

    They supposed to add
    ‘scheme’ => ‘smtp’
    in config/mail.php in ‘mailers’=> ‘smtp’ section.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search