eporsche / daybreak

Simple timesheets and vacation management for small businesses.
MIT License
126 stars 37 forks source link

[Suggestion] - disable mail sending on local env #15

Closed Nejcc closed 3 years ago

Nejcc commented 3 years ago

if is mail not set on local env you get errors like this

Connection could not be established with host mailhog :stream_socket_client(): php_network_getaddresses: getaddrinfo failed: No such host is known.

Solution:

if (!app()->environment('local')) {
    Mail::to($absence->employee)->send(new AbsenceRemoved());
}
Nejcc commented 3 years ago

one example : app\Actions\AddAbsence.php:87

nejcdev commented 3 years ago

for the local or testing this is issue yes or mabye you dont want to send any email at all and keep it without mabye some config settings ? just an suggestion

eporsche commented 3 years ago

Just set the environment variable MAIL_MAILER to log and EMails won't be sent. https://laravel.com/docs/8.x/mail#log-driver