laravel / lumen-framework

The Laravel Lumen Framework.
https://lumen.laravel.com
MIT License
1.48k stars 419 forks source link

custom from email Id not used by lumen #684

Closed sachinsts closed 6 years ago

sachinsts commented 6 years ago

Description:

every time default from mail Id used by lumen instead of using parameter passed in mail function, $user_data['mail_from'] = $_ENV['MY_CUSTOM_EMAIL_ID']; $user_data['mail_from_name'] = $_ENV['CUSTO_MAIL_FROM_NAME']; $user_data['email_to'] = 'test@yopmail.com'; $user_data['mail_subject'] = "test"; Mail::send('Mailtranscript.email', $user_data, function ($message_body) use ($user_data) { $message_body->from($user_data['mail_from'], $user_data['mail_from_name']); $message_body->to($user_data['email_to']); $message_body->subject($user_data['mail_subject']); });

Steps To Reproduce:

sachinsts commented 6 years ago

is there anyone who can help me on this issue, i just stuck at this issue,i tried composer update,dump autoload,try to clear cahe, tried getenv function ,but no luck

hakuno commented 6 years ago

@sachinv2

Debug the $user_data['mail_from'] array element with dd function and you will see that.

Because I'm unsure about your $_ENV['MY_CUSTOM_EMAIL_ID'] use. You might use env function instead of. For instance, see below

$user_data['mail_from'] = env('MY_CUSTOM_EMAIL_ID', 'default@mail.com');

Maybe you'll get it working at this way. Check it out...

driesvints commented 6 years ago

Closing this issue because it's already solved, old or not relevant anymore. Feel free to reply if you're still experiencing this issue.