Back to Top

Help & Support

Get instant answers 24/7

Top > Miscellaneous Topics

Send outbound emails from your Laravel application

Before using the outbound system, you must enable outbound for either "quarantine users and account contacts" or "smart host relay," in the  Outbound > Outbound Settings tab:

https://www.spamhero.com/cp2/outbound/settings


You can easily set up your Laravel application to send emails through SpamHero's outbound service, by copying these 4 variables into your .env file:


And setting the appropriate values for these 4:

MAIL_USERNAME=YOUR_DOMAIN_NAME.com
MAIL_PASSWORD="Your_Smart_Host_Password (quoted)"
MAIL_FROM_ADDRESS=default_from_address@your-domain.com
MAIL_FROM_NAME=default_from_name

If you don't have "outbound smart host relay" enabled in your SpamHero outbound settings, and just have outbound enabled for individual quarantine users and account contacts, you can alternatively set the credentials above from one of these users instead.

And that's it! You can then send emails as outlined in Laravel's official documentation:

Mail::to(["someone@example.com"])->locale("en")->send(new Notification("some Parameters"));
If you have made any changes to config/mail.php, you'll want to revert them for this to work. You can grab a copy from Laravel's official github.

Last updated March 28, 2024