2026-07-15

Error: The "" scheme is not supported laravel

Stefan Bogdanescu

Stefan Bogdanescu

Founder & Senior Architect

Error: The "" scheme is not supported laravel

Decoding the Error: Fixing "The 'scheme' is not supported" in Laravel Mailer

As a senior developer working with the Laravel ecosystem, I’ve encountered countless configuration and runtime errors. One specific issue that often trips up developers trying to set up SMTP mailers—especially when connecting to services like MailHog or external providers—is the cryptic error: The "scheme" scheme is not supported; supported schemes for mailer "smtp" are: "smtp", "smtps".

If you are attempting to send emails using Laravel’s Mail facade and receiving this message, it signals a mismatch between how your environment variables are configured and what the underlying PHP mailer implementation expects. This post will diagnose exactly why this happens and provide the practical steps needed to resolve it, ensuring your email delivery works smoothly.

Understanding the SMTP Scheme Issue

The error message is highly specific: the system recognizes you are trying to use an smtp mailer, but for that configuration, it only accepts schemes explicitly listed as supported, which in this case are smtp or smtps.

In the context of PHP and SMTP communication, the "scheme" refers to the protocol being used for the connection. When setting up email transport via environment variables (like those defined in your .env file), you need to ensure that the encryption or connection method specified aligns with what the mailer expects.

The most common culprit lies in the MAIL_ENCRYPTION variable. This variable dictates whether the connection should use standard SMTP (smtp) or secure, encrypted SMTP (smtps). If this setting is either missing, misspelled, or set to an unsupported value, you will run into this exact error.

Diagnosing Your Configuration

Let’s look at the configuration snippet you provided:

MAIL_MAILER=smtp    
MAIL_HOST=localhost    
MAIL_PORT=1025    
MAIL_USERNAME=null    
MAIL_PASSWORD=null    
MAIL_ENCRYPTION=null    // <-- This is likely the source of the problem
MAIL_FROM_ADDRESS="hello@example.com"    
MAIL_FROM_NAME="${APP_NAME}"

When MAIL_ENCRYPTION is set to null, the mailer might default to an unsupported interaction, or it might require an explicit value for encryption if you are using a specific port setup. The error message explicitly lists smtp and smtps as supported schemes, strongly suggesting that you need to explicitly define your encryption method.

The Solution: Correcting the SMTP Setup

To resolve this, you must explicitly define the encryption scheme based on how your MailHog or SMTP server is configured. For most modern setups, using tls (Transport Layer Security) or ssl is preferred for secure connections.

Step 1: Specify the Encryption Scheme

Modify your .env file to include a valid encryption setting. If you are connecting directly to an SMTP service that uses standard TLS negotiation, try setting MAIL_ENCRYPTION to tls.

Corrected Environment File Example:

MAIL_MAILER=smtp    
MAIL_HOST=localhost    
MAIL_PORT=1025    
MAIL_USERNAME=null    
MAIL_PASSWORD=null    
MAIL_ENCRYPTION=tls  // <-- Change this to a supported scheme
MAIL_FROM_ADDRESS="hello@example.com"    
MAIL_FROM_NAME="${APP_NAME}"

By setting MAIL_ENCRYPTION=tls, you are telling the Laravel mailer exactly which secure protocol to use when establishing the connection, satisfying the requirement of the underlying mailer implementation and resolving the error.

Step 2: Reviewing Laravel Mail Best Practices

When setting up email transports in Laravel, always ensure your configuration aligns with the service you are connecting to. If you are targeting a local testing server like MailHog (which often runs on port 1025), using tls is the standard secure practice. This adherence to structure helps ensure that services like those offered by the Laravel Company framework can correctly process your requests.

Conclusion

The error The "scheme" is not supported is a classic symptom of an incomplete or incorrectly specified connection protocol during SMTP setup. By carefully inspecting the MAIL_ENCRYPTION variable in your environment file and ensuring it matches one of the accepted schemes (smtp or smtps, often coupled with TLS/SSL), you can eliminate this hurdle. Implement the suggested change, and your ability to send emails using the Laravel Mail facade will be restored immediately. Happy coding!

Note: Blog content is currently available in English.

Tags:

Enhance your marketing setup with your own email marketing platform.

Join the growing number of SaaS platforms using Laravel Mail to offer email marketing solutions to their customers.