diff --git a/app/Http/Controllers/AppController.php b/app/Http/Controllers/AppController.php index 8b33c71e93..647ea7dd2e 100644 --- a/app/Http/Controllers/AppController.php +++ b/app/Http/Controllers/AppController.php @@ -60,10 +60,7 @@ class AppController extends BaseController $database = Input::get('database'); $dbType = 'mysql'; // $database['default']; $database['connections'] = [$dbType => $database['type']]; - $mail = Input::get('mail'); - $email = $mail['username']; - $mail['from']['address'] = $email; if ($test == 'mail') { return self::testMail($mail); @@ -97,6 +94,7 @@ class AppController extends BaseController $_ENV['MAIL_HOST'] = $mail['host']; $_ENV['MAIL_USERNAME'] = $mail['username']; $_ENV['MAIL_FROM_NAME'] = $mail['from']['name']; + $_ENV['MAIL_FROM_ADDRESS'] = $mail['from']['address']; $_ENV['MAIL_PASSWORD'] = $mail['password']; $_ENV['PHANTOMJS_CLOUD_KEY'] = 'a-demo-key-with-low-quota-per-ip-address'; $_ENV['MAILGUN_DOMAIN'] = $mail['mailgun_domain']; @@ -173,8 +171,8 @@ class AppController extends BaseController $_ENV['MAIL_HOST'] = $mail['host']; $_ENV['MAIL_USERNAME'] = $mail['username']; $_ENV['MAIL_FROM_NAME'] = $mail['from']['name']; + $_ENV['MAIL_FROM_ADDRESS'] = $mail['from']['address']; $_ENV['MAIL_PASSWORD'] = $mail['password']; - $_ENV['MAIL_FROM_ADDRESS'] = $mail['username']; $_ENV['MAILGUN_DOMAIN'] = $mail['mailgun_domain']; $_ENV['MAILGUN_SECRET'] = $mail['mailgun_secret']; } @@ -218,7 +216,7 @@ class AppController extends BaseController private function testMail($mail) { - $email = $mail['username']; + $email = $mail['from']['address']; $fromName = $mail['from']['name']; foreach ($mail as $key => $val) { diff --git a/resources/views/partials/system_settings.blade.php b/resources/views/partials/system_settings.blade.php index debee42066..038e9d2fa3 100644 --- a/resources/views/partials/system_settings.blade.php +++ b/resources/views/partials/system_settings.blade.php @@ -24,7 +24,7 @@ {!! Former::text('database[type][database]')->label('Database')->value(isset($_ENV['DB_DATABASE']) ? $_ENV['DB_DATABASE'] : 'ninja') !!} {!! Former::text('database[type][username]')->label('Username')->value(isset($_ENV['DB_USERNAME']) ? $_ENV['DB_USERNAME'] : 'ninja') !!} {!! Former::password('database[type][password]')->label('Password')->value(isset($_ENV['DB_PASSWORD']) ? $_ENV['DB_PASSWORD'] : 'ninja') !!} - {!! Former::actions( Button::primary('Test connection')->small()->withAttributes(['onclick' => 'testDatabase()']), ' ' ) !!} + {!! Former::actions( Button::primary('Test connection')->small()->withAttributes(['onclick' => 'testDatabase()']), ' ' ) !!} @@ -37,9 +37,11 @@ {!! Former::select('mail[driver]')->label('Driver')->options(['smtp' => 'SMTP', 'mail' => 'Mail', 'sendmail' => 'Sendmail', 'mailgun' => 'Mailgun']) ->value(isset($_ENV['MAIL_DRIVER']) ? $_ENV['MAIL_DRIVER'] : 'smtp')->setAttributes(['onchange' => 'mailDriverChange()']) !!} {!! Former::text('mail[from][name]')->label('From Name') - ->value(isset($_ENV['MAIL_FROM_NAME']) ? $_ENV['MAIL_FROM_NAME'] : '') !!} - {!! Former::text('mail[username]')->label('Email') - ->value(isset($_ENV['MAIL_USERNAME']) ? $_ENV['MAIL_USERNAME'] : '') !!} + ->value(isset($_ENV['MAIL_FROM_NAME']) ? $_ENV['MAIL_FROM_NAME'] : '') !!} + {!! Former::text('mail[from][address]')->label('From Address') + ->value(isset($_ENV['MAIL_FROM_ADDRESS']) ? $_ENV['MAIL_FROM_ADDRESS'] : '') !!} + {!! Former::text('mail[username]')->label('Username') + ->value(isset($_ENV['MAIL_USERNAME']) ? $_ENV['MAIL_USERNAME'] : '') !!}