Welcome to Laracast
First, to make your post readable, put your code between 3`
like this
For your pb, did you define a (or the right) MX record in your DNS?
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I am trying to configure the SMTP mail on my hosting server with a laravel 8 project, I entered the data on the .env file but when I try to send the form I get a server error 500, from the log file I found that the error in detail is this here: local.ERROR : Expected response code 250 but got code "550", with message "550 5.1.0 invalid domain. I tried the SMTP data also on the local machine and the form works while on the hosting server it does not, I also tried to launch commands from the web.php with Artisan following the routes, the following:
Route :: get ('cache', function () {
\ Illuminate \ Support \ Facades \ Artisan :: call ('config: cache');
echo 'ok';
});
Route :: get ('clear', function () {
\ Illuminate \ Support \ Facades \ Artisan :: call ('config: clear');
echo 'ok';
});
but even in this case the error continues to persist and at this point I don't know where to put my hands. Hope someone can help me and thanks in advance
Well how I usually do it is like this ->
MAIL_MAILER=mail
MAIL_HOST=mail.domain.com
MAIL_PORT={your mail port}
MAIL_USERNAME={yourn mail username}
MAIL_PASSWORD={your mail password}
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS="[email protected]"
MAIL_FROM_NAME="${APP_NAME}"
and inside config/mail.php i used ->
<?php
return [
'driver' => env('MAIL_DRIVER', 'mail'),
'host' => env('MAIL_HOST', 'mail.host.com'),
'port' => env('MAIL_PORT', 465),
'from' => [
'address' => '[email protected]',
'name' => 'host.com',
],
'encryption' => env('MAIL_ENCRYPTION', 'tls'),
'username' => env('MAIL_USERNAME'),
'password' => env('MAIL_PASSWORD'),
// 'mailers' => [
// 'smtp' => [
// 'transport' => 'smtp',
// 'host' => env('MAIL_HOST', 'smtp.mailgun.org'),
// 'port' => env('MAIL_PORT', 587),
// 'encryption' => env('MAIL_ENCRYPTION', 'tls'),
// 'username' => env('MAIL_USERNAME'),
// 'password' => env('MAIL_PASSWORD'),
// 'timeout' => null,
// 'auth_mode' => null,
// ],
// 'ses' => [
// 'transport' => 'ses',
// ],
// 'mailgun' => [
// 'transport' => 'mailgun',
// ],
// 'postmark' => [
// 'transport' => 'postmark',
// ],
// 'sendmail' => [
// 'transport' => 'sendmail',
// 'path' => '/usr/sbin/sendmail -bs',
// ],
// 'log' => [
// 'transport' => 'log',
// 'channel' => env('MAIL_LOG_CHANNEL'),
// ],
// 'array' => [
// 'transport' => 'array',
// ],
// ],
'from' => [
'address' => env('MAIL_FROM_ADDRESS', '[email protected]'),
'name' => env('MAIL_FROM_NAME', 'Example'),
],
'markdown' => [
'theme' => 'default',
'paths' => [
resource_path('views/vendor/mail'),
],
],
];
Please or to participate in this conversation.