Docs / SMTP Setup - Laravel

SMTP setup — Laravel (PHP)

You can get them on the token management page. For security reasons, a token is shown only once — at the moment it is created.

Option 1. Edit the .env file in your project root:

.env
MAIL_MAILER=smtp
MAIL_HOST=smtp.postwing.app
MAIL_PORT=8025
MAIL_USERNAME=your_username
MAIL_PASSWORD=your_password
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS=your_from_email_address
MAIL_FROM_NAME="${APP_NAME}"

Option 2. If you need to update the configuration programmatically, you can do it like this:

php
config([
    'mail.mailers.smtp.host' => 'smtp.postwing.app',
    'mail.mailers.smtp.port' => 8025,
    'mail.mailers.smtp.username' => 'your_username',
    'mail.mailers.smtp.password' => 'your_password',
    'mail.mailers.smtp.encryption' => null,
]);

Option 3. You can also edit config/mail.php directly:

config/mail.php
'smtp' => [
    'transport' => 'smtp',
    'host' => env('MAIL_HOST', 'smtp.postwing.app'),
    'port' => env('MAIL_PORT', 8025),
    'encryption' => env('MAIL_ENCRYPTION', null),
    'username' => env('MAIL_USERNAME', 'your_username'),
    'password' => env('MAIL_PASSWORD', 'your_password'),
    'timeout' => null,
    'auth_mode' => null,
],

After applying the changes, don’t forget to clear the Laravel cache:

bash
php artisan config:clear

For testing you can use Laravel’s Mail facade:

php
Mail::to('recipient@example.com')->send(new \App\Mail\TestEmail());