sdsfdesf
sdsfdesf

Reputation: 31

How to use Postfix to send email in Laravel 5.4

I want to send a verification email and I want to do it by using Postfix. Is there any way to do it?

Upvotes: 1

Views: 7324

Answers (1)

antoineMoPa
antoineMoPa

Reputation: 1024

Postfix provides a sendmail command for compatibility with the original sendmail (https://en.wikipedia.org/wiki/Sendmail).

Once postfix is installed, you can follow the regular Laravel instructions for sendmail.

See config/mail.php, you'll have to change the driver to sendmail. Some visitors might still use older versions of Laravel (like 4.2), in this case, the file is app/config/mail.php.

To test the configuration, you can use a one-liner like this in php artisan tinker, but you'll have to create a view in resources/views/test.blade.php (With any content you want).

// Change username for your real username
Mail::send('test', array('key' => 'value'), function($message){$message->to('username@localhost','me')->from('noreply@localhost')->subject('test');});

The email should appear in this file: /var/mail/$USER

Upvotes: 3

Related Questions