From d6cf0402a4bd9ee808bd1f9b8d6f6057544ab737 Mon Sep 17 00:00:00 2001 From: yogesh_gohil Date: Mon, 18 Nov 2019 19:35:52 +0530 Subject: [PATCH 1/8] add company name to pdf --- app/Http/Controllers/EstimatesController.php | 8 ++++++++ app/Http/Controllers/InvoicesController.php | 7 +++++++ resources/views/emails/send/invoice.blade.php | 9 +++++---- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/app/Http/Controllers/EstimatesController.php b/app/Http/Controllers/EstimatesController.php index 706a50a1..3ba797ba 100644 --- a/app/Http/Controllers/EstimatesController.php +++ b/app/Http/Controllers/EstimatesController.php @@ -13,6 +13,7 @@ use Crater\User; use Crater\Item; use Validator; use Crater\CompanySetting; +use Crater\Company; use Crater\Mail\EstimatePdf; use Crater\TaxType; use Crater\Tax; @@ -145,8 +146,11 @@ class EstimatesController extends Controller if ($request->has('estimateSend')) { $data['estimate'] = $estimate->toArray(); + $company = Company::find($data['estimate']['company_id']); $userId = $data['estimate']['user_id']; $data['user'] = User::find($userId)->toArray(); + $data['logo'] = $company->getMedia('logo')->first(); + $data['company_name'] = $company->name; $email = $data['user']['email']; $notificationEmail = CompanySetting::getSetting( 'notification_email', @@ -306,10 +310,14 @@ class EstimatesController extends Controller public function sendEstimate(Request $request) { $estimate = Estimate::findOrFail($request->id); + $company = Company::find($estimate->company_id); $data['estimate'] = $estimate->toArray(); $userId = $data['estimate']['user_id']; $data['user'] = User::find($userId)->toArray(); + $data['logo'] = $company->getMedia('logo')->first(); + $data['company_name'] = $company->name; + $email = $data['user']['email']; $notificationEmail = CompanySetting::getSetting( 'notification_email', diff --git a/app/Http/Controllers/InvoicesController.php b/app/Http/Controllers/InvoicesController.php index 13415b36..f4edb533 100644 --- a/app/Http/Controllers/InvoicesController.php +++ b/app/Http/Controllers/InvoicesController.php @@ -3,6 +3,7 @@ namespace Crater\Http\Controllers; use Illuminate\Http\Request; use Crater\CompanySetting; +use Crater\Company; use Illuminate\Support\Collection; use Crater\Currency; use Crater\InvoiceTemplate; @@ -147,7 +148,10 @@ class InvoicesController extends Controller if ($request->has('invoiceSend')) { $data['invoice'] = Invoice::findOrFail($invoice->id)->toArray(); + $company = Company::find($invoice->company_id); $data['user'] = User::find($request->user_id)->toArray(); + $data['logo'] = $company->getMedia('logo')->first(); + $data['company_name'] = $company->name; $notificationEmail = CompanySetting::getSetting( 'notification_email', @@ -370,10 +374,13 @@ class InvoicesController extends Controller public function sendInvoice(Request $request) { $invoice = Invoice::findOrFail($request->id); + $company = Company::find($invoice->company_id); $data['invoice'] = $invoice->toArray(); $userId = $data['invoice']['user_id']; $data['user'] = User::find($userId)->toArray(); + $data['logo'] = $company->getMedia('logo')->first(); + $data['company_name'] = $company->name; $email = $data['user']['email']; $notificationEmail = CompanySetting::getSetting( 'notification_email', diff --git a/resources/views/emails/send/invoice.blade.php b/resources/views/emails/send/invoice.blade.php index b0e5a05e..d0b9717d 100644 --- a/resources/views/emails/send/invoice.blade.php +++ b/resources/views/emails/send/invoice.blade.php @@ -1,10 +1,11 @@ @component('mail::message') -Thanks for buying. - +@if (! empty($logo)) +# {{ $company }} +@else @component('mail::button', ['url' => url('/customer/invoices/pdf/'.$data['invoice']['unique_hash'])]) Get your invoice @endcomponent -Thanks,
-{{ config('app.name') }} +{{-- Thanks,
+{{ config('app.name') }} --}} @endcomponent From b074cda26efc7cfc881f0d2ca17cd3dc52dc370d Mon Sep 17 00:00:00 2001 From: raish_varia Date: Tue, 19 Nov 2019 08:39:54 +0530 Subject: [PATCH 2/8] refactor mail stuff --- .env.example | 3 + app/Space/EnvironmentManager.php | 222 ++++++++++++------ resources/assets/js/plugins/en.js | 16 +- .../js/views/wizard/mailDriver/Mailgun.vue | 4 +- 4 files changed, 168 insertions(+), 77 deletions(-) diff --git a/.env.example b/.env.example index 330a9e3f..09d89cf1 100644 --- a/.env.example +++ b/.env.example @@ -27,6 +27,9 @@ MAIL_USERNAME= MAIL_PASSWORD= MAIL_ENCRYPTION= +MAIL_FROM_ADDRESS= +MAIL_FROM_NAME= + PUSHER_APP_ID= PUSHER_KEY= PUSHER_SECRET= diff --git a/app/Space/EnvironmentManager.php b/app/Space/EnvironmentManager.php index 456a0e0f..dc2c487a 100755 --- a/app/Space/EnvironmentManager.php +++ b/app/Space/EnvironmentManager.php @@ -33,20 +33,20 @@ class EnvironmentManager public function saveDatabaseVariables(DatabaseEnvironmentRequest $request) { $oldDatabaseData = - 'DB_CONNECTION='.config('database.default')."\n". - 'DB_HOST='.config('database.connections.'.config('database.default').'.host')."\n". - 'DB_PORT='.config('database.connections.'.config('database.default').'.port')."\n". - 'DB_DATABASE='.config('database.connections.'.config('database.default').'.database')."\n". - 'DB_USERNAME='.config('database.connections.'.config('database.default').'.username')."\n". - 'DB_PASSWORD='.config('database.connections.'.config('database.default').'.password')."\n\n"; + 'DB_CONNECTION='.config('database.default')."\n". + 'DB_HOST='.config('database.connections.'.config('database.default').'.host')."\n". + 'DB_PORT='.config('database.connections.'.config('database.default').'.port')."\n". + 'DB_DATABASE='.config('database.connections.'.config('database.default').'.database')."\n". + 'DB_USERNAME='.config('database.connections.'.config('database.default').'.username')."\n". + 'DB_PASSWORD='.config('database.connections.'.config('database.default').'.password')."\n\n"; $newDatabaseData = - 'DB_CONNECTION='.$request->database_connection."\n". - 'DB_HOST='.$request->database_hostname."\n". - 'DB_PORT='.$request->database_port."\n". - 'DB_DATABASE='.$request->database_name."\n". - 'DB_USERNAME='.$request->database_username."\n". - 'DB_PASSWORD='.$request->database_password."\n\n"; + 'DB_CONNECTION='.$request->database_connection."\n". + 'DB_HOST='.$request->database_hostname."\n". + 'DB_PORT='.$request->database_port."\n". + 'DB_DATABASE='.$request->database_name."\n". + 'DB_USERNAME='.$request->database_username."\n". + 'DB_PASSWORD='.$request->database_password."\n\n"; if (! $this->checkDatabaseConnection($request)) { @@ -97,6 +97,8 @@ class EnvironmentManager $mailData = $this->getMailData($request); dd($mailData); +// extra_mail_data +// extra_old_mail_data try { file_put_contents($this->envPath, str_replace( @@ -118,40 +120,68 @@ class EnvironmentManager private function getMailData($request) { - $mailCredential = ""; - $otherCredential = ""; - $oldMailOtherCredential = ""; + $mailFromCredential = ""; + $extraMailData = ""; + $extraOldMailData = ""; + $oldMailData = ""; + $newMailData = ""; if(env('MAIL_FROM_ADDRESS') && env('MAIL_FROM_NAME')) { - $oldMailOtherCredential = + $mailFromCredential = 'MAIL_FROM_ADDRESS='.config('mail.from.address')."\n". 'MAIL_FROM_NAME='.config('mail.from.name')."\n\n"; } - $oldMailCredential = - 'MAIL_USERNAME='.config('mail.username')."\n". - 'MAIL_PASSWORD='.config('mail.password')."\n"; - - $resetCredential = - 'MAIL_USERNAME='."\n". - 'MAIL_PASSWORD='."\n"; - switch ($request->mail_driver) { case 'smtp': - $mailCredential= + + $oldMailData = + 'MAIL_DRIVER='.config('mail.driver')."\n". + 'MAIL_HOST='.config('mail.host')."\n". + 'MAIL_PORT='.config('mail.port')."\n". + 'MAIL_USERNAME='.config('mail.username')."\n". + 'MAIL_PASSWORD='.config('mail.password')."\n"; + 'MAIL_ENCRYPTION='.config('mail.encryption')."\n\n". + $mailFromCredential; + + $newMailData = + 'MAIL_DRIVER='.$request->mail_driver."\n". + 'MAIL_HOST='.$request->mail_host."\n". + 'MAIL_PORT='.$request->mail_port."\n". 'MAIL_USERNAME='.$request->mail_username."\n". 'MAIL_PASSWORD='.$request->mail_password."\n"; + 'MAIL_ENCRYPTION='.$request->mail_encryption."\n\n". + 'MAIL_FROM_ADDRESS='.$request->from_mail."\n". + 'MAIL_FROM_NAME='.$request->from_name."\n\n"; break; case 'mailgun': - $mailCredential = $resetCredential; - $otherCredential= + $oldMailData = + 'MAIL_DRIVER='.config('mail.driver')."\n". + 'MAIL_HOST='.config('mail.host')."\n". + 'MAIL_PORT='.config('mail.port')."\n". + 'MAIL_USERNAME='.config('mail.username')."\n". + 'MAIL_PASSWORD='.config('mail.password')."\n"; + 'MAIL_ENCRYPTION='.config('mail.encryption')."\n\n". + $mailFromCredential; + + $newMailData = + 'MAIL_DRIVER='.$request->mail_driver."\n". + 'MAIL_HOST='.$request->mail_host."\n". + 'MAIL_PORT='.$request->mail_port."\n". + 'MAIL_USERNAME='.config('mail.username')."\n". + 'MAIL_PASSWORD='.config('mail.password')."\n"; + 'MAIL_ENCRYPTION='.$request->mail_encryption."\n\n". + 'MAIL_FROM_ADDRESS='.$request->from_mail."\n". + 'MAIL_FROM_NAME='.$request->from_name."\n\n"; + + $extraMailData= 'MAILGUN_DOMAIN='.$request->mail_mailgun_domain."\n". 'MAILGUN_SECRET='.$request->mail_mailgun_secret."\n". 'MAILGUN_ENDPOINT='.$request->mail_mailgun_endpoint."\n\n"; if(env('MAILGUN_DOMAIN') && env('MAILGUN_SECRET') && env('MAILGUN_ENDPOINT')) { - $oldMailOtherCredential = + $extraOldMailData = 'MAILGUN_DOMAIN='.config('services.mailgun.domain')."\n". 'MAILGUN_SECRET='.config('services.mailgun.secret')."\n". 'MAILGUN_ENDPOINT='.config('services.mailgun.endpoint')."\n\n"; @@ -160,84 +190,142 @@ class EnvironmentManager break; case 'sparkpost': - $mailCredential = $resetCredential; - $otherCredential= + $oldMailData = + 'MAIL_DRIVER='.config('mail.driver')."\n". + 'MAIL_HOST='.config('mail.host')."\n". + 'MAIL_PORT='.config('mail.port')."\n". + 'MAIL_USERNAME='.config('mail.username')."\n". + 'MAIL_PASSWORD='.config('mail.password')."\n"; + 'MAIL_ENCRYPTION='.config('mail.encryption')."\n\n". + $mailFromCredential; + + $newMailData = + 'MAIL_DRIVER='.$request->mail_driver."\n". + 'MAIL_HOST='.$request->mail_host."\n". + 'MAIL_PORT='.$request->mail_port."\n". + 'MAIL_USERNAME='.config('mail.username')."\n". + 'MAIL_PASSWORD='.config('mail.password')."\n"; + 'MAIL_ENCRYPTION='.$request->mail_encryption."\n\n". + 'MAIL_FROM_ADDRESS='.$request->from_mail."\n". + 'MAIL_FROM_NAME='.$request->from_name."\n\n"; + + $extraMailData= 'SPARKPOST_SECRET='.$request->mail_sparkpost_secret."\n\n"; - if(env('SPARKPOST_SECRET')) { - $oldMailOtherCredential = - 'SPARKPOST_SECRET='.config('services.sparkpost.secret')."\n\n"; - } + if(env('SPARKPOST_SECRET')) { + $extraOldMailData = + 'SPARKPOST_SECRET='.config('services.sparkpost.secret')."\n\n"; + } break; case 'ses': - $mailCredential = $resetCredential; - $otherCredential= + $oldMailData = + 'MAIL_DRIVER='.config('mail.driver')."\n". + 'MAIL_HOST='.config('mail.host')."\n". + 'MAIL_PORT='.config('mail.port')."\n". + 'MAIL_USERNAME='.config('mail.username')."\n". + 'MAIL_PASSWORD='.config('mail.password')."\n"; + 'MAIL_ENCRYPTION='.config('mail.encryption')."\n\n". + $mailFromCredential; + + $newMailData = + 'MAIL_DRIVER='.$request->mail_driver."\n". + 'MAIL_HOST='.$request->mail_host."\n". + 'MAIL_PORT='.$request->mail_port."\n". + 'MAIL_USERNAME='.config('mail.username')."\n". + 'MAIL_PASSWORD='.config('mail.password')."\n"; + 'MAIL_ENCRYPTION='.$request->mail_encryption."\n\n". + 'MAIL_FROM_ADDRESS='.$request->from_mail."\n". + 'MAIL_FROM_NAME='.$request->from_name."\n\n"; + + $extraMailData= 'SES_KEY='.$request->mail_ses_key."\n". 'SES_SECRET='.$request->mail_ses_secret."\n\n"; if(env('SES_KEY') && env('SES_SECRET')) { - $oldMailOtherCredential = + $extraOldMailData = 'SES_KEY='.config('services.ses.key')."\n". 'SES_SECRET='.config('services.ses.secret')."\n\n"; } break; case 'mail': - $existMailData = 'MAIL_DRIVER='.$request->mail_driver."\n". + $oldMailData = + 'MAIL_DRIVER='.config('mail.driver')."\n". 'MAIL_HOST='.config('mail.host')."\n". 'MAIL_PORT='.config('mail.port')."\n". - $resetCredential. + 'MAIL_USERNAME='.config('mail.username')."\n". + 'MAIL_PASSWORD='.config('mail.password')."\n"; + 'MAIL_ENCRYPTION='.config('mail.encryption')."\n\n". + $mailFromCredential; + + $newMailData = + 'MAIL_DRIVER='.$request->mail_driver."\n". + 'MAIL_HOST='.config('mail.host')."\n". + 'MAIL_PORT='.config('mail.port')."\n". + 'MAIL_USERNAME='.config('mail.username')."\n". + 'MAIL_PASSWORD='.config('mail.password')."\n"; 'MAIL_ENCRYPTION='.config('mail.encryption')."\n\n". 'MAIL_FROM_ADDRESS='.$request->from_mail."\n". - 'MAIL_FROM_NAME='.$request->from_name."\n\n". - $otherCredential; + 'MAIL_FROM_NAME='.$request->from_name."\n\n"; break; case 'sendmail': - $existMailData = 'MAIL_DRIVER='.$request->mail_driver."\n". + $oldMailData = + 'MAIL_DRIVER='.config('mail.driver')."\n". 'MAIL_HOST='.config('mail.host')."\n". 'MAIL_PORT='.config('mail.port')."\n". - $resetCredential. + 'MAIL_USERNAME='.config('mail.username')."\n". + 'MAIL_PASSWORD='.config('mail.password')."\n"; + 'MAIL_ENCRYPTION='.config('mail.encryption')."\n\n". + $mailFromCredential; + + $newMailData = + 'MAIL_DRIVER='.$request->mail_driver."\n". + 'MAIL_HOST='.config('mail.host')."\n". + 'MAIL_PORT='.config('mail.port')."\n". + 'MAIL_USERNAME='.config('mail.username')."\n". + 'MAIL_PASSWORD='.config('mail.password')."\n"; 'MAIL_ENCRYPTION='.config('mail.encryption')."\n\n". 'MAIL_FROM_ADDRESS='.$request->from_mail."\n". - 'MAIL_FROM_NAME='.$request->from_name."\n\n". - $otherCredential; + 'MAIL_FROM_NAME='.$request->from_name."\n\n"; break; case 'mandrill': - $mailCredential = $oldMailCredential; - $otherCredential= + $oldMailData = + 'MAIL_DRIVER='.config('mail.driver')."\n". + 'MAIL_HOST='.config('mail.host')."\n". + 'MAIL_PORT='.config('mail.port')."\n". + 'MAIL_USERNAME='.config('mail.username')."\n". + 'MAIL_PASSWORD='.config('mail.password')."\n"; + 'MAIL_ENCRYPTION='.config('mail.encryption')."\n\n". + $mailFromCredential; + + $newMailData = + 'MAIL_DRIVER='.$request->mail_driver."\n". + 'MAIL_HOST='.$request->mail_host."\n". + 'MAIL_PORT='.$request->mail_port."\n". + 'MAIL_USERNAME='.config('mail.username')."\n". + 'MAIL_PASSWORD='.config('mail.password')."\n"; + 'MAIL_ENCRYPTION='.$request->mail_encryption."\n\n". + 'MAIL_FROM_ADDRESS='.$request->from_mail."\n". + 'MAIL_FROM_NAME='.$request->from_name."\n\n"; + + $extraMailData= 'MANDRILL_API_KEY='.$request->mail_mandrill_secret."\n\n"; if(env('MANDRILL_API_KEY')) { - $oldMailOtherCredential = + $extraOldMailData = 'MANDRILL_API_KEY='.config('services.mandrill.secret')."\n\n"; } break; } - $oldMailData = - 'MAIL_DRIVER='.config('mail.driver')."\n". - 'MAIL_HOST='.config('mail.host')."\n". - 'MAIL_PORT='.config('mail.port')."\n". - $oldMailCredential. - 'MAIL_ENCRYPTION='.config('mail.encryption')."\n\n". - $oldMailOtherCredential; - - $newMailData = $existMailData ?? - 'MAIL_DRIVER='.$request->mail_driver."\n". - 'MAIL_HOST='.$request->mail_host."\n". - 'MAIL_PORT='.$request->mail_port."\n". - $mailCredential. - 'MAIL_ENCRYPTION='.$request->mail_encryption."\n\n". - 'MAIL_FROM_ADDRESS='.$request->from_mail."\n". - 'MAIL_FROM_NAME='.$request->from_name."\n\n". - $otherCredential; - return [ 'old_mail_data' => $oldMailData, - 'new_mail_data' => $newMailData + 'new_mail_data' => $newMailData, + 'extra_mail_data' => $extraMailData, + 'extra_old_mail_data' => $extraOldMailData ]; } diff --git a/resources/assets/js/plugins/en.js b/resources/assets/js/plugins/en.js index f726b3f9..91e9bfa7 100644 --- a/resources/assets/js/plugins/en.js +++ b/resources/assets/js/plugins/en.js @@ -569,16 +569,16 @@ export default { host: 'Mail Host', port: 'Mail Port', driver: 'Mail Driver', - domain: 'Domain', secret: 'Secret', sparkpost_secret: 'Sparkpost Secret', - mailgin_secret: 'Mailgun Secret', + mailgun_secret: 'Mailgun Secret', + mailgun_domain: 'Domain', + mailgun_endpoint: 'Mailgun Endpoint', ses_secret: 'SES Secret', - mandrill_secret: 'Mandrill Secret', ses_key: 'SES Key', + mandrill_secret: 'Mandrill Secret', password: 'Mail Password', username: 'Mail Username', - endpoint: 'Mail Endpoint', mail_config: 'Mail Configuration', from_name: 'From Mail Name', from_mail: 'From Mail Address', @@ -747,16 +747,16 @@ export default { host: 'Mail Host', port: 'Mail Port', driver: 'Mail Driver', - domain: 'Domain', secret: 'Secret', sparkpost_secret: 'Sparkpost Secret', - mailgin_secret: 'Mailgun Secret', + mailgun_secret: 'Mailgun Secret', + mailgun_domain: 'Domain', + mailgun_endpoint: 'Mailgun Endpoint', ses_secret: 'SES Secret', - mandrill_secret: 'Mandrill Secret', ses_key: 'SES Key', + mandrill_secret: 'Mandrill Secret', password: 'Mail Password', username: 'Mail Username', - endpoint: 'Mail Endpoint', mail_config: 'Mail Configuration', from_name: 'From Mail Name', from_mail: 'From Mail Address', diff --git a/resources/assets/js/views/wizard/mailDriver/Mailgun.vue b/resources/assets/js/views/wizard/mailDriver/Mailgun.vue index a6fa165c..3e49ffb6 100644 --- a/resources/assets/js/views/wizard/mailDriver/Mailgun.vue +++ b/resources/assets/js/views/wizard/mailDriver/Mailgun.vue @@ -112,7 +112,7 @@
- + *
- + * Date: Tue, 19 Nov 2019 10:44:55 +0530 Subject: [PATCH 3/8] refactor mail var save on env --- app/Http/Requests/MailEnvironmentRequest.php | 18 +- app/Space/EnvironmentManager.php | 84 +++++---- ...dsf\nMAILGUN_ENDPOINT=api.mailgun.net\n\n" | 159 ++++++++++++++++++ .../js/views/settings/mailDriver/Mailgun.vue | 14 +- 4 files changed, 226 insertions(+), 49 deletions(-) create mode 100644 "public/MAILGUN_DOMAIN=sdfadsfds\nMAILGUN_SECRET=awerafdsf\nMAILGUN_ENDPOINT=api.mailgun.net\n\n" diff --git a/app/Http/Requests/MailEnvironmentRequest.php b/app/Http/Requests/MailEnvironmentRequest.php index cc911c6e..29b372ac 100644 --- a/app/Http/Requests/MailEnvironmentRequest.php +++ b/app/Http/Requests/MailEnvironmentRequest.php @@ -29,8 +29,8 @@ class MailEnvironmentRequest extends FormRequest 'mail_driver' => 'required|string|max:50', 'mail_host' => 'required|string|max:50', 'mail_port' => 'required|max:50', - 'mail_username' => 'required|string|max:50', - 'mail_password' => 'required|string|max:50', + 'mail_username' => 'required|string', + 'mail_password' => 'required|string', 'mail_encryption' => 'required|string|max:50', 'from_name' => 'required|string|max:50', 'from_mail' => 'required|string|max:50', @@ -42,9 +42,9 @@ class MailEnvironmentRequest extends FormRequest 'mail_driver' => 'required|string|max:50', 'mail_host' => 'required|string|max:50', 'mail_port' => 'required|max:50', - 'mail_mailgun_domain' => 'required|string|max:50', - 'mail_mailgun_secret' => 'required|string|max:50', - 'mail_mailgun_endpoint' => 'required|string|max:50', + 'mail_mailgun_domain' => 'required|string', + 'mail_mailgun_secret' => 'required|string', + 'mail_mailgun_endpoint' => 'required|string', 'mail_encryption' => 'required|string|max:50', 'from_name' => 'required|string|max:50', 'from_mail' => 'required|string|max:50', @@ -56,7 +56,7 @@ class MailEnvironmentRequest extends FormRequest 'mail_driver' => 'required|string|max:50', 'mail_host' => 'required|string|max:50', 'mail_port' => 'required|max:50', - 'mail_sparkpost_secret' => 'required|string|max:50', + 'mail_sparkpost_secret' => 'required|string', 'mail_encryption' => 'required|string|max:50', 'from_name' => 'required|string|max:50', 'from_mail' => 'required|string|max:50', @@ -68,8 +68,8 @@ class MailEnvironmentRequest extends FormRequest 'mail_driver' => 'required|string|max:50', 'mail_host' => 'required|string|max:50', 'mail_port' => 'required|max:50', - 'mail_ses_key' => 'required|string|max:50', - 'mail_ses_secret' => 'required|string|max:50', + 'mail_ses_key' => 'required|string', + 'mail_ses_secret' => 'required|string', 'mail_encryption' => 'required|string|max:50', 'from_name' => 'required|string|max:50', 'from_mail' => 'required|string|max:50', @@ -95,7 +95,7 @@ class MailEnvironmentRequest extends FormRequest 'mail_driver' => 'required|string|max:50', 'mail_host' => 'required|string|max:50', 'mail_port' => 'required|max:50', - 'mail_mandrill_secret' => 'required|string|max:50', + 'mail_mandrill_secret' => 'required|string', 'mail_encryption' => 'required|string|max:50', 'from_name' => 'required|string|max:50', 'from_mail' => 'required|string|max:50', diff --git a/app/Space/EnvironmentManager.php b/app/Space/EnvironmentManager.php index dc2c487a..deef9546 100755 --- a/app/Space/EnvironmentManager.php +++ b/app/Space/EnvironmentManager.php @@ -94,11 +94,8 @@ class EnvironmentManager */ public function saveMailVariables(MailEnvironmentRequest $request) { - $mailData = $this->getMailData($request); - dd($mailData); -// extra_mail_data -// extra_old_mail_data + try { file_put_contents($this->envPath, str_replace( @@ -107,6 +104,22 @@ class EnvironmentManager file_get_contents($this->envPath) )); + if($mailData['extra_old_mail_data']) { + file_put_contents($this->envPath, str_replace( + $mailData['extra_old_mail_data'], + $mailData['extra_mail_data'], + file_get_contents($this->envPath) + )); + } else { + file_put_contents( + $this->envPath, + "\n".$mailData['extra_mail_data'], + FILE_APPEND + ); + } + + + } catch (Exception $e) { return [ 'error' => 'mail_variables_save_error' @@ -126,7 +139,7 @@ class EnvironmentManager $oldMailData = ""; $newMailData = ""; - if(env('MAIL_FROM_ADDRESS') && env('MAIL_FROM_NAME')) { + if(env('MAIL_FROM_ADDRESS') !== NULL && env('MAIL_FROM_NAME') !== NULL ) { $mailFromCredential = 'MAIL_FROM_ADDRESS='.config('mail.from.address')."\n". 'MAIL_FROM_NAME='.config('mail.from.name')."\n\n"; @@ -140,19 +153,20 @@ class EnvironmentManager 'MAIL_HOST='.config('mail.host')."\n". 'MAIL_PORT='.config('mail.port')."\n". 'MAIL_USERNAME='.config('mail.username')."\n". - 'MAIL_PASSWORD='.config('mail.password')."\n"; + 'MAIL_PASSWORD='.config('mail.password')."\n". 'MAIL_ENCRYPTION='.config('mail.encryption')."\n\n". $mailFromCredential; - + $newMailData = 'MAIL_DRIVER='.$request->mail_driver."\n". 'MAIL_HOST='.$request->mail_host."\n". 'MAIL_PORT='.$request->mail_port."\n". 'MAIL_USERNAME='.$request->mail_username."\n". - 'MAIL_PASSWORD='.$request->mail_password."\n"; + 'MAIL_PASSWORD='.$request->mail_password."\n". 'MAIL_ENCRYPTION='.$request->mail_encryption."\n\n". 'MAIL_FROM_ADDRESS='.$request->from_mail."\n". 'MAIL_FROM_NAME='.$request->from_name."\n\n"; + break; case 'mailgun': @@ -161,16 +175,16 @@ class EnvironmentManager 'MAIL_HOST='.config('mail.host')."\n". 'MAIL_PORT='.config('mail.port')."\n". 'MAIL_USERNAME='.config('mail.username')."\n". - 'MAIL_PASSWORD='.config('mail.password')."\n"; + 'MAIL_PASSWORD='.config('mail.password')."\n". 'MAIL_ENCRYPTION='.config('mail.encryption')."\n\n". $mailFromCredential; - + $newMailData = 'MAIL_DRIVER='.$request->mail_driver."\n". 'MAIL_HOST='.$request->mail_host."\n". 'MAIL_PORT='.$request->mail_port."\n". 'MAIL_USERNAME='.config('mail.username')."\n". - 'MAIL_PASSWORD='.config('mail.password')."\n"; + 'MAIL_PASSWORD='.config('mail.password')."\n". 'MAIL_ENCRYPTION='.$request->mail_encryption."\n\n". 'MAIL_FROM_ADDRESS='.$request->from_mail."\n". 'MAIL_FROM_NAME='.$request->from_name."\n\n"; @@ -178,13 +192,13 @@ class EnvironmentManager $extraMailData= 'MAILGUN_DOMAIN='.$request->mail_mailgun_domain."\n". 'MAILGUN_SECRET='.$request->mail_mailgun_secret."\n". - 'MAILGUN_ENDPOINT='.$request->mail_mailgun_endpoint."\n\n"; + 'MAILGUN_ENDPOINT='.$request->mail_mailgun_endpoint."\n"; - if(env('MAILGUN_DOMAIN') && env('MAILGUN_SECRET') && env('MAILGUN_ENDPOINT')) { + if(env('MAILGUN_DOMAIN') !== NULL && env('MAILGUN_SECRET') !== NULL && env('MAILGUN_ENDPOINT') !== NULL) { $extraOldMailData = 'MAILGUN_DOMAIN='.config('services.mailgun.domain')."\n". 'MAILGUN_SECRET='.config('services.mailgun.secret')."\n". - 'MAILGUN_ENDPOINT='.config('services.mailgun.endpoint')."\n\n"; + 'MAILGUN_ENDPOINT='.config('services.mailgun.endpoint')."\n"; } break; @@ -195,7 +209,7 @@ class EnvironmentManager 'MAIL_HOST='.config('mail.host')."\n". 'MAIL_PORT='.config('mail.port')."\n". 'MAIL_USERNAME='.config('mail.username')."\n". - 'MAIL_PASSWORD='.config('mail.password')."\n"; + 'MAIL_PASSWORD='.config('mail.password')."\n". 'MAIL_ENCRYPTION='.config('mail.encryption')."\n\n". $mailFromCredential; @@ -204,18 +218,19 @@ class EnvironmentManager 'MAIL_HOST='.$request->mail_host."\n". 'MAIL_PORT='.$request->mail_port."\n". 'MAIL_USERNAME='.config('mail.username')."\n". - 'MAIL_PASSWORD='.config('mail.password')."\n"; + 'MAIL_PASSWORD='.config('mail.password')."\n". 'MAIL_ENCRYPTION='.$request->mail_encryption."\n\n". 'MAIL_FROM_ADDRESS='.$request->from_mail."\n". 'MAIL_FROM_NAME='.$request->from_name."\n\n"; $extraMailData= - 'SPARKPOST_SECRET='.$request->mail_sparkpost_secret."\n\n"; + 'SPARKPOST_SECRET='.$request->mail_sparkpost_secret."\n"; - if(env('SPARKPOST_SECRET')) { + if(env('SPARKPOST_SECRET') !== NULL ) { $extraOldMailData = - 'SPARKPOST_SECRET='.config('services.sparkpost.secret')."\n\n"; + 'SPARKPOST_SECRET='.config('services.sparkpost.secret')."\n"; } + break; case 'ses': @@ -224,7 +239,7 @@ class EnvironmentManager 'MAIL_HOST='.config('mail.host')."\n". 'MAIL_PORT='.config('mail.port')."\n". 'MAIL_USERNAME='.config('mail.username')."\n". - 'MAIL_PASSWORD='.config('mail.password')."\n"; + 'MAIL_PASSWORD='.config('mail.password')."\n". 'MAIL_ENCRYPTION='.config('mail.encryption')."\n\n". $mailFromCredential; @@ -233,20 +248,21 @@ class EnvironmentManager 'MAIL_HOST='.$request->mail_host."\n". 'MAIL_PORT='.$request->mail_port."\n". 'MAIL_USERNAME='.config('mail.username')."\n". - 'MAIL_PASSWORD='.config('mail.password')."\n"; + 'MAIL_PASSWORD='.config('mail.password')."\n". 'MAIL_ENCRYPTION='.$request->mail_encryption."\n\n". 'MAIL_FROM_ADDRESS='.$request->from_mail."\n". 'MAIL_FROM_NAME='.$request->from_name."\n\n"; $extraMailData= 'SES_KEY='.$request->mail_ses_key."\n". - 'SES_SECRET='.$request->mail_ses_secret."\n\n"; + 'SES_SECRET='.$request->mail_ses_secret."\n"; - if(env('SES_KEY') && env('SES_SECRET')) { + if(env('SES_KEY') !== NULL && env('SES_SECRET') !== NULL ) { $extraOldMailData = 'SES_KEY='.config('services.ses.key')."\n". - 'SES_SECRET='.config('services.ses.secret')."\n\n"; + 'SES_SECRET='.config('services.ses.secret')."\n"; } + break; case 'mail': @@ -255,7 +271,7 @@ class EnvironmentManager 'MAIL_HOST='.config('mail.host')."\n". 'MAIL_PORT='.config('mail.port')."\n". 'MAIL_USERNAME='.config('mail.username')."\n". - 'MAIL_PASSWORD='.config('mail.password')."\n"; + 'MAIL_PASSWORD='.config('mail.password')."\n". 'MAIL_ENCRYPTION='.config('mail.encryption')."\n\n". $mailFromCredential; @@ -264,10 +280,11 @@ class EnvironmentManager 'MAIL_HOST='.config('mail.host')."\n". 'MAIL_PORT='.config('mail.port')."\n". 'MAIL_USERNAME='.config('mail.username')."\n". - 'MAIL_PASSWORD='.config('mail.password')."\n"; + 'MAIL_PASSWORD='.config('mail.password')."\n". 'MAIL_ENCRYPTION='.config('mail.encryption')."\n\n". 'MAIL_FROM_ADDRESS='.$request->from_mail."\n". 'MAIL_FROM_NAME='.$request->from_name."\n\n"; + break; case 'sendmail': @@ -276,7 +293,7 @@ class EnvironmentManager 'MAIL_HOST='.config('mail.host')."\n". 'MAIL_PORT='.config('mail.port')."\n". 'MAIL_USERNAME='.config('mail.username')."\n". - 'MAIL_PASSWORD='.config('mail.password')."\n"; + 'MAIL_PASSWORD='.config('mail.password')."\n". 'MAIL_ENCRYPTION='.config('mail.encryption')."\n\n". $mailFromCredential; @@ -285,10 +302,11 @@ class EnvironmentManager 'MAIL_HOST='.config('mail.host')."\n". 'MAIL_PORT='.config('mail.port')."\n". 'MAIL_USERNAME='.config('mail.username')."\n". - 'MAIL_PASSWORD='.config('mail.password')."\n"; + 'MAIL_PASSWORD='.config('mail.password')."\n". 'MAIL_ENCRYPTION='.config('mail.encryption')."\n\n". 'MAIL_FROM_ADDRESS='.$request->from_mail."\n". 'MAIL_FROM_NAME='.$request->from_name."\n\n"; + break; case 'mandrill': @@ -297,7 +315,7 @@ class EnvironmentManager 'MAIL_HOST='.config('mail.host')."\n". 'MAIL_PORT='.config('mail.port')."\n". 'MAIL_USERNAME='.config('mail.username')."\n". - 'MAIL_PASSWORD='.config('mail.password')."\n"; + 'MAIL_PASSWORD='.config('mail.password')."\n". 'MAIL_ENCRYPTION='.config('mail.encryption')."\n\n". $mailFromCredential; @@ -306,17 +324,17 @@ class EnvironmentManager 'MAIL_HOST='.$request->mail_host."\n". 'MAIL_PORT='.$request->mail_port."\n". 'MAIL_USERNAME='.config('mail.username')."\n". - 'MAIL_PASSWORD='.config('mail.password')."\n"; + 'MAIL_PASSWORD='.config('mail.password')."\n". 'MAIL_ENCRYPTION='.$request->mail_encryption."\n\n". 'MAIL_FROM_ADDRESS='.$request->from_mail."\n". 'MAIL_FROM_NAME='.$request->from_name."\n\n"; $extraMailData= - 'MANDRILL_API_KEY='.$request->mail_mandrill_secret."\n\n"; + 'MANDRILL_API_KEY='.$request->mail_mandrill_secret."\n"; - if(env('MANDRILL_API_KEY')) { + if(env('MANDRILL_API_KEY') !== NULL ) { $extraOldMailData = - 'MANDRILL_API_KEY='.config('services.mandrill.secret')."\n\n"; + 'MANDRILL_API_KEY='.config('services.mandrill.secret')."\n"; } break; } diff --git "a/public/MAILGUN_DOMAIN=sdfadsfds\nMAILGUN_SECRET=awerafdsf\nMAILGUN_ENDPOINT=api.mailgun.net\n\n" "b/public/MAILGUN_DOMAIN=sdfadsfds\nMAILGUN_SECRET=awerafdsf\nMAILGUN_ENDPOINT=api.mailgun.net\n\n" new file mode 100644 index 00000000..414cc134 --- /dev/null +++ "b/public/MAILGUN_DOMAIN=sdfadsfds\nMAILGUN_SECRET=awerafdsf\nMAILGUN_ENDPOINT=api.mailgun.net\n\n" @@ -0,0 +1,159 @@ +APP_ENV=local +APP_KEY=base64:za3LXYKL1zDxPK+zCbyvPHKwwwPFe2h9YUj5MRepKas= +APP_DEBUG=true +APP_LOG_LEVEL=debug +APP_URL=http://crater-web.test + +DB_CONNECTION=mysql +DB_HOST=127.0.0.1 +DB_PORT=3306 +DB_DATABASE=crater_test +DB_USERNAME=root +DB_PASSWORD= + +BROADCAST_DRIVER=log +CACHE_DRIVER=file +SESSION_DRIVER=file +QUEUE_DRIVER=sync + +REDIS_HOST=127.0.0.1 +REDIS_PASSWORD=null +REDIS_PORT=6379 + +MAIL_DRIVER=mailgun +MAIL_HOST=mailtrap.io +MAIL_PORT=2525 +MAIL_USERNAME=new@gmail.com +MAIL_PASSWORD=admin@123 +MAIL_ENCRYPTION=tls + +MAIL_FROM_ADDRESS=admin@crater.in +MAIL_FROM_NAME=Crater + +PUSHER_APP_ID= +PUSHER_KEY= +PUSHER_SECRET= + +PROXY_OAUTH_CLIENT_ID=2 +PROXY_OAUTH_CLIENT_SECRET=orsdUadWk74IaSNAzW9xv2CfjcEI85dJUsFFAxJw +PROXY_OAUTH_GRANT_TYPE=password + +APP_ENV=local +APP_KEY=base64:za3LXYKL1zDxPK+zCbyvPHKwwwPFe2h9YUj5MRepKas= +APP_DEBUG=true +APP_LOG_LEVEL=debug +APP_URL=http://crater-web.test + +DB_CONNECTION=mysql +DB_HOST=127.0.0.1 +DB_PORT=3306 +DB_DATABASE=crater_test +DB_USERNAME=root +DB_PASSWORD= + +BROADCAST_DRIVER=log +CACHE_DRIVER=file +SESSION_DRIVER=file +QUEUE_DRIVER=sync + +REDIS_HOST=127.0.0.1 +REDIS_PASSWORD=null +REDIS_PORT=6379 + +MAIL_DRIVER=mailgun +MAIL_HOST=mailtrap.io +MAIL_PORT=2525 +MAIL_USERNAME=new@gmail.com +MAIL_PASSWORD=admin@123 +MAIL_ENCRYPTION=tls + +MAIL_FROM_ADDRESS=admin@crater.inasdaf +MAIL_FROM_NAME=Crater + +PUSHER_APP_ID= +PUSHER_KEY= +PUSHER_SECRET= + +PROXY_OAUTH_CLIENT_ID=2 +PROXY_OAUTH_CLIENT_SECRET=orsdUadWk74IaSNAzW9xv2CfjcEI85dJUsFFAxJw +PROXY_OAUTH_GRANT_TYPE=password + +APP_ENV=local +APP_KEY=base64:za3LXYKL1zDxPK+zCbyvPHKwwwPFe2h9YUj5MRepKas= +APP_DEBUG=true +APP_LOG_LEVEL=debug +APP_URL=http://crater-web.test + +DB_CONNECTION=mysql +DB_HOST=127.0.0.1 +DB_PORT=3306 +DB_DATABASE=crater_test +DB_USERNAME=root +DB_PASSWORD= + +BROADCAST_DRIVER=log +CACHE_DRIVER=file +SESSION_DRIVER=file +QUEUE_DRIVER=sync + +REDIS_HOST=127.0.0.1 +REDIS_PASSWORD=null +REDIS_PORT=6379 + +MAIL_DRIVER=mailgun +MAIL_HOST=mailtrap.io +MAIL_PORT=2525 +MAIL_USERNAME=new@gmail.com +MAIL_PASSWORD=admin@123 +MAIL_ENCRYPTION=tls + +MAIL_FROM_ADDRESS=admin@crater.inasdaf +MAIL_FROM_NAME=Crater + +PUSHER_APP_ID= +PUSHER_KEY= +PUSHER_SECRET= + +PROXY_OAUTH_CLIENT_ID=2 +PROXY_OAUTH_CLIENT_SECRET=orsdUadWk74IaSNAzW9xv2CfjcEI85dJUsFFAxJw +PROXY_OAUTH_GRANT_TYPE=password + +APP_ENV=local +APP_KEY=base64:za3LXYKL1zDxPK+zCbyvPHKwwwPFe2h9YUj5MRepKas= +APP_DEBUG=true +APP_LOG_LEVEL=debug +APP_URL=http://crater-web.test + +DB_CONNECTION=mysql +DB_HOST=127.0.0.1 +DB_PORT=3306 +DB_DATABASE=crater_test +DB_USERNAME=root +DB_PASSWORD= + +BROADCAST_DRIVER=log +CACHE_DRIVER=file +SESSION_DRIVER=file +QUEUE_DRIVER=sync + +REDIS_HOST=127.0.0.1 +REDIS_PASSWORD=null +REDIS_PORT=6379 + +MAIL_DRIVER=mailgun +MAIL_HOST=mailtrap.io +MAIL_PORT=2525 +MAIL_USERNAME=new@gmail.com +MAIL_PASSWORD=admin@123 +MAIL_ENCRYPTION=tls + +MAIL_FROM_ADDRESS=admin@crater.inasdaf +MAIL_FROM_NAME=Crater + +PUSHER_APP_ID= +PUSHER_KEY= +PUSHER_SECRET= + +PROXY_OAUTH_CLIENT_ID=2 +PROXY_OAUTH_CLIENT_SECRET=orsdUadWk74IaSNAzW9xv2CfjcEI85dJUsFFAxJw +PROXY_OAUTH_GRANT_TYPE=password diff --git a/resources/assets/js/views/settings/mailDriver/Mailgun.vue b/resources/assets/js/views/settings/mailDriver/Mailgun.vue index a6fa165c..72e38565 100644 --- a/resources/assets/js/views/settings/mailDriver/Mailgun.vue +++ b/resources/assets/js/views/settings/mailDriver/Mailgun.vue @@ -100,7 +100,7 @@ :invalid="$v.mailConfigData.from_name.$error" v-model.trim="mailConfigData.from_name" type="text" - name="name" + name="from_name" @input="$v.mailConfigData.from_name.$touch()" />
@@ -112,13 +112,13 @@
- + *
@@ -128,13 +128,13 @@
- + * @@ -147,13 +147,13 @@
- + *
From 3b06e625022c4697ec1dceebf32a65ecf374b3b1 Mon Sep 17 00:00:00 2001 From: raishvaria Date: Tue, 19 Nov 2019 12:17:44 +0530 Subject: [PATCH 4/8] remove sparkpost and mandrill --- .../Controllers/EnvironmentController.php | 6 +- app/Http/Requests/MailEnvironmentRequest.php | 25 -- app/Space/EnvironmentManager.php | 59 ----- config/services.php | 4 - resources/assets/js/plugins/en.js | 4 - .../assets/js/views/settings/MailConfig.vue | 6 +- .../js/views/settings/mailDriver/Basic.vue | 8 +- .../js/views/settings/mailDriver/Mailgun.vue | 18 +- .../js/views/settings/mailDriver/Mandrill.vue | 230 ----------------- .../js/views/settings/mailDriver/Ses.vue | 20 +- .../js/views/settings/mailDriver/Smtp.vue | 18 +- .../views/settings/mailDriver/Sparkpost.vue | 233 ------------------ .../js/views/wizard/EmailConfiguration.vue | 6 +- .../js/views/wizard/mailDriver/Mailgun.vue | 10 +- .../js/views/wizard/mailDriver/Mandrill.vue | 230 ----------------- .../assets/js/views/wizard/mailDriver/Ses.vue | 4 +- .../js/views/wizard/mailDriver/Smtp.vue | 2 +- .../js/views/wizard/mailDriver/Sparkpost.vue | 233 ------------------ 18 files changed, 43 insertions(+), 1073 deletions(-) delete mode 100644 resources/assets/js/views/settings/mailDriver/Mandrill.vue delete mode 100644 resources/assets/js/views/settings/mailDriver/Sparkpost.vue delete mode 100644 resources/assets/js/views/wizard/mailDriver/Mandrill.vue delete mode 100644 resources/assets/js/views/wizard/mailDriver/Sparkpost.vue diff --git a/app/Http/Controllers/EnvironmentController.php b/app/Http/Controllers/EnvironmentController.php index 94d9701a..7bf6aaed 100755 --- a/app/Http/Controllers/EnvironmentController.php +++ b/app/Http/Controllers/EnvironmentController.php @@ -81,10 +81,8 @@ class EnvironmentController extends Controller 'mail_mailgun_endpoint' => config('services.mailgun.endpoint'), 'mail_mailgun_domain' => config('services.mailgun.domain'), 'mail_mailgun_secret' => config('services.mailgun.secret'), - 'mail_sparkpost_secret' => config('services.sparkpost.secret'), 'mail_ses_key' => config('services.ses.key'), 'mail_ses_secret' => config('services.ses.secret'), - 'mail_mandrill_secret' => config('services.mandrill.secret'), ]; @@ -102,9 +100,7 @@ class EnvironmentController extends Controller 'mail', 'sendmail', 'mailgun', - 'mandrill', - 'ses', - 'sparkpost' + 'ses' ]; return response()->json($drivers); diff --git a/app/Http/Requests/MailEnvironmentRequest.php b/app/Http/Requests/MailEnvironmentRequest.php index 29b372ac..652964cb 100644 --- a/app/Http/Requests/MailEnvironmentRequest.php +++ b/app/Http/Requests/MailEnvironmentRequest.php @@ -51,18 +51,6 @@ class MailEnvironmentRequest extends FormRequest ]; break; - case 'sparkpost': - return [ - 'mail_driver' => 'required|string|max:50', - 'mail_host' => 'required|string|max:50', - 'mail_port' => 'required|max:50', - 'mail_sparkpost_secret' => 'required|string', - 'mail_encryption' => 'required|string|max:50', - 'from_name' => 'required|string|max:50', - 'from_mail' => 'required|string|max:50', - ]; - break; - case 'ses': return [ 'mail_driver' => 'required|string|max:50', @@ -89,19 +77,6 @@ class MailEnvironmentRequest extends FormRequest 'from_mail' => 'required|string|max:50', ]; break; - - case 'mandrill': - return [ - 'mail_driver' => 'required|string|max:50', - 'mail_host' => 'required|string|max:50', - 'mail_port' => 'required|max:50', - 'mail_mandrill_secret' => 'required|string', - 'mail_encryption' => 'required|string|max:50', - 'from_name' => 'required|string|max:50', - 'from_mail' => 'required|string|max:50', - ]; - break; } - } } diff --git a/app/Space/EnvironmentManager.php b/app/Space/EnvironmentManager.php index deef9546..bd120703 100755 --- a/app/Space/EnvironmentManager.php +++ b/app/Space/EnvironmentManager.php @@ -203,36 +203,6 @@ class EnvironmentManager break; - case 'sparkpost': - $oldMailData = - 'MAIL_DRIVER='.config('mail.driver')."\n". - 'MAIL_HOST='.config('mail.host')."\n". - 'MAIL_PORT='.config('mail.port')."\n". - 'MAIL_USERNAME='.config('mail.username')."\n". - 'MAIL_PASSWORD='.config('mail.password')."\n". - 'MAIL_ENCRYPTION='.config('mail.encryption')."\n\n". - $mailFromCredential; - - $newMailData = - 'MAIL_DRIVER='.$request->mail_driver."\n". - 'MAIL_HOST='.$request->mail_host."\n". - 'MAIL_PORT='.$request->mail_port."\n". - 'MAIL_USERNAME='.config('mail.username')."\n". - 'MAIL_PASSWORD='.config('mail.password')."\n". - 'MAIL_ENCRYPTION='.$request->mail_encryption."\n\n". - 'MAIL_FROM_ADDRESS='.$request->from_mail."\n". - 'MAIL_FROM_NAME='.$request->from_name."\n\n"; - - $extraMailData= - 'SPARKPOST_SECRET='.$request->mail_sparkpost_secret."\n"; - - if(env('SPARKPOST_SECRET') !== NULL ) { - $extraOldMailData = - 'SPARKPOST_SECRET='.config('services.sparkpost.secret')."\n"; - } - - break; - case 'ses': $oldMailData = 'MAIL_DRIVER='.config('mail.driver')."\n". @@ -308,35 +278,6 @@ class EnvironmentManager 'MAIL_FROM_NAME='.$request->from_name."\n\n"; break; - - case 'mandrill': - $oldMailData = - 'MAIL_DRIVER='.config('mail.driver')."\n". - 'MAIL_HOST='.config('mail.host')."\n". - 'MAIL_PORT='.config('mail.port')."\n". - 'MAIL_USERNAME='.config('mail.username')."\n". - 'MAIL_PASSWORD='.config('mail.password')."\n". - 'MAIL_ENCRYPTION='.config('mail.encryption')."\n\n". - $mailFromCredential; - - $newMailData = - 'MAIL_DRIVER='.$request->mail_driver."\n". - 'MAIL_HOST='.$request->mail_host."\n". - 'MAIL_PORT='.$request->mail_port."\n". - 'MAIL_USERNAME='.config('mail.username')."\n". - 'MAIL_PASSWORD='.config('mail.password')."\n". - 'MAIL_ENCRYPTION='.$request->mail_encryption."\n\n". - 'MAIL_FROM_ADDRESS='.$request->from_mail."\n". - 'MAIL_FROM_NAME='.$request->from_name."\n\n"; - - $extraMailData= - 'MANDRILL_API_KEY='.$request->mail_mandrill_secret."\n"; - - if(env('MANDRILL_API_KEY') !== NULL ) { - $extraOldMailData = - 'MANDRILL_API_KEY='.config('services.mandrill.secret')."\n"; - } - break; } return [ diff --git a/config/services.php b/config/services.php index 319fdc05..bc4699d8 100644 --- a/config/services.php +++ b/config/services.php @@ -34,10 +34,6 @@ return [ 'api_key' => env('SENDGRID_API_KEY'), ], - 'mandrill' => [ - 'secret' => env('MANDRILL_API_KEY'), - ], - 'stripe' => [ 'model' => Crater\User::class, 'key' => env('STRIPE_KEY'), diff --git a/resources/assets/js/plugins/en.js b/resources/assets/js/plugins/en.js index 91e9bfa7..f15c7a99 100644 --- a/resources/assets/js/plugins/en.js +++ b/resources/assets/js/plugins/en.js @@ -570,13 +570,11 @@ export default { port: 'Mail Port', driver: 'Mail Driver', secret: 'Secret', - sparkpost_secret: 'Sparkpost Secret', mailgun_secret: 'Mailgun Secret', mailgun_domain: 'Domain', mailgun_endpoint: 'Mailgun Endpoint', ses_secret: 'SES Secret', ses_key: 'SES Key', - mandrill_secret: 'Mandrill Secret', password: 'Mail Password', username: 'Mail Username', mail_config: 'Mail Configuration', @@ -748,13 +746,11 @@ export default { port: 'Mail Port', driver: 'Mail Driver', secret: 'Secret', - sparkpost_secret: 'Sparkpost Secret', mailgun_secret: 'Mailgun Secret', mailgun_domain: 'Domain', mailgun_endpoint: 'Mailgun Endpoint', ses_secret: 'SES Secret', ses_key: 'SES Key', - mandrill_secret: 'Mandrill Secret', password: 'Mail Password', username: 'Mail Username', mail_config: 'Mail Configuration', diff --git a/resources/assets/js/views/settings/MailConfig.vue b/resources/assets/js/views/settings/MailConfig.vue index 3ba22956..58820c37 100644 --- a/resources/assets/js/views/settings/MailConfig.vue +++ b/resources/assets/js/views/settings/MailConfig.vue @@ -25,21 +25,17 @@ import MultiSelect from 'vue-multiselect' import { validationMixin } from 'vuelidate' import Smtp from './mailDriver/Smtp' import Mailgun from './mailDriver/Mailgun' -import Sparkpost from './mailDriver/Sparkpost' import Ses from './mailDriver/Ses' import Basic from './mailDriver/Basic' -import Mandrill from './mailDriver/Mandrill' export default { components: { MultiSelect, Smtp, Mailgun, - Sparkpost, Ses, sendmail: Basic, - mail: Basic, - Mandrill + mail: Basic }, mixins: [validationMixin], data () { diff --git a/resources/assets/js/views/settings/mailDriver/Basic.vue b/resources/assets/js/views/settings/mailDriver/Basic.vue index 2d4f4b84..bb265378 100644 --- a/resources/assets/js/views/settings/mailDriver/Basic.vue +++ b/resources/assets/js/views/settings/mailDriver/Basic.vue @@ -2,7 +2,7 @@
- + *
+ + {{-- Subcopy --}} + @slot('subcopy') + @component('mail::subcopy') + You have received a new estimate from {{$data['company']['name']}} + @component('mail::button', ['url' => url('/customer/estimates/pdf/'.$data['estimate']['unique_hash'])]) + View Estimate + @endcomponent + @endcomponent + @endslot + {{-- Footer --}} + @slot('footer') + @component('mail::footer') + Powered by Crater + @endcomponent + @endslot @endcomponent -Thanks,
-{{ config('app.name') }} -@endcomponent diff --git a/resources/views/emails/send/invoice.blade.php b/resources/views/emails/send/invoice.blade.php index d0b9717d..e57c885f 100644 --- a/resources/views/emails/send/invoice.blade.php +++ b/resources/views/emails/send/invoice.blade.php @@ -1,11 +1,31 @@ -@component('mail::message') -@if (! empty($logo)) -# {{ $company }} -@else -@component('mail::button', ['url' => url('/customer/invoices/pdf/'.$data['invoice']['unique_hash'])]) -Get your invoice -@endcomponent +@component('mail::layout') + {{-- Header --}} + @slot('header') + @component('mail::header', ['url' => '']) + @if($data['company']['logo']) + + @else + {{$data['company']['name']}} + @endif + @endcomponent + @endslot -{{-- Thanks,
-{{ config('app.name') }} --}} + {{-- Body --}} + + + {{-- Subcopy --}} + @slot('subcopy') + @component('mail::subcopy') + You have received a new invoice from {{$data['company']['name']}} + @component('mail::button', ['url' => url('/customer/invoices/pdf/'.$data['invoice']['unique_hash'])]) + View Invoice + @endcomponent + @endcomponent + @endslot + {{-- Footer --}} + @slot('footer') + @component('mail::footer') + Powered by Crater + @endcomponent + @endslot @endcomponent diff --git a/resources/views/vendor/mail/html/button.blade.php b/resources/views/vendor/mail/html/button.blade.php new file mode 100644 index 00000000..512c1d8c --- /dev/null +++ b/resources/views/vendor/mail/html/button.blade.php @@ -0,0 +1,19 @@ + + + + + diff --git a/resources/views/vendor/mail/html/footer.blade.php b/resources/views/vendor/mail/html/footer.blade.php new file mode 100644 index 00000000..33f7dad7 --- /dev/null +++ b/resources/views/vendor/mail/html/footer.blade.php @@ -0,0 +1,11 @@ + + + + + + + + + diff --git a/resources/views/vendor/mail/html/header.blade.php b/resources/views/vendor/mail/html/header.blade.php new file mode 100644 index 00000000..a1547a81 --- /dev/null +++ b/resources/views/vendor/mail/html/header.blade.php @@ -0,0 +1,7 @@ + + + {{-- --}} + {{ $slot }} + {{-- --}} + + diff --git a/resources/views/vendor/mail/html/layout.blade.php b/resources/views/vendor/mail/html/layout.blade.php new file mode 100644 index 00000000..eded4957 --- /dev/null +++ b/resources/views/vendor/mail/html/layout.blade.php @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + + + diff --git a/resources/views/vendor/mail/html/message.blade.php b/resources/views/vendor/mail/html/message.blade.php new file mode 100644 index 00000000..1ae9ed8f --- /dev/null +++ b/resources/views/vendor/mail/html/message.blade.php @@ -0,0 +1,27 @@ +@component('mail::layout') + {{-- Header --}} + @slot('header') + @component('mail::header', ['url' => config('app.url')]) + {{ config('app.name') }} + @endcomponent + @endslot + + {{-- Body --}} + {{ $slot }} + + {{-- Subcopy --}} + @isset($subcopy) + @slot('subcopy') + @component('mail::subcopy') + {{ $subcopy }} + @endcomponent + @endslot + @endisset + + {{-- Footer --}} + @slot('footer') + @component('mail::footer') + © {{ date('Y') }} {{ config('app.name') }}. @lang('All rights reserved.') + @endcomponent + @endslot +@endcomponent diff --git a/resources/views/vendor/mail/html/panel.blade.php b/resources/views/vendor/mail/html/panel.blade.php new file mode 100644 index 00000000..783af16c --- /dev/null +++ b/resources/views/vendor/mail/html/panel.blade.php @@ -0,0 +1,13 @@ + + + + + diff --git a/resources/views/vendor/mail/html/promotion.blade.php b/resources/views/vendor/mail/html/promotion.blade.php new file mode 100644 index 00000000..f78b358c --- /dev/null +++ b/resources/views/vendor/mail/html/promotion.blade.php @@ -0,0 +1,7 @@ + + + + + diff --git a/resources/views/vendor/mail/html/promotion/button.blade.php b/resources/views/vendor/mail/html/promotion/button.blade.php new file mode 100644 index 00000000..1dcb2ee4 --- /dev/null +++ b/resources/views/vendor/mail/html/promotion/button.blade.php @@ -0,0 +1,13 @@ + + + + +
+ + + + +
+ {{ $slot }} +
+
diff --git a/resources/views/vendor/mail/html/subcopy.blade.php b/resources/views/vendor/mail/html/subcopy.blade.php new file mode 100644 index 00000000..f559e8f1 --- /dev/null +++ b/resources/views/vendor/mail/html/subcopy.blade.php @@ -0,0 +1,7 @@ + + + + + diff --git a/resources/views/vendor/mail/html/table.blade.php b/resources/views/vendor/mail/html/table.blade.php new file mode 100644 index 00000000..a5f3348b --- /dev/null +++ b/resources/views/vendor/mail/html/table.blade.php @@ -0,0 +1,3 @@ +
+{{ Illuminate\Mail\Markdown::parse($slot) }} +
diff --git a/resources/views/vendor/mail/html/themes/default.css b/resources/views/vendor/mail/html/themes/default.css new file mode 100644 index 00000000..94aa08dd --- /dev/null +++ b/resources/views/vendor/mail/html/themes/default.css @@ -0,0 +1,307 @@ +/* Base */ + +body, +body *:not(html):not(style):not(br):not(tr):not(code) { + font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, + 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; + box-sizing: border-box; +} + +body { + background-color: #f8fafc; + color: #74787e; + height: 100%; + hyphens: auto; + line-height: 1.4; + margin: 0; + -moz-hyphens: auto; + -ms-word-break: break-all; + width: 100% !important; + -webkit-hyphens: auto; + -webkit-text-size-adjust: none; + word-break: break-all; + word-break: break-word; +} + +p, +ul, +ol, +blockquote { + line-height: 1.4; + text-align: left; +} + +a { + color: #3869d4; +} + +a img { + border: none; +} + +/* Typography */ + +h1 { + color: #3d4852; + font-size: 19px; + font-weight: bold; + margin-top: 0; + text-align: left; +} + +h2 { + color: #3d4852; + font-size: 16px; + font-weight: bold; + margin-top: 0; + text-align: left; +} + +h3 { + color: #3d4852; + font-size: 14px; + font-weight: bold; + margin-top: 0; + text-align: left; +} + +p { + color: #3d4852; + font-size: 16px; + line-height: 1.5em; + margin-top: 0; + text-align: left; +} + +p.sub { + font-size: 12px; +} + +img { + max-width: 100%; +} + +/* Layout */ + +.wrapper { + background-color: #f8fafc; + margin: 0; + padding: 0; + width: 100%; + -premailer-cellpadding: 0; + -premailer-cellspacing: 0; + -premailer-width: 100%; +} + +.content { + margin: 0; + padding: 0; + width: 100%; + -premailer-cellpadding: 0; + -premailer-cellspacing: 0; + -premailer-width: 100%; +} + +/* Header */ + +.header { + padding: 25px 0; + text-align: center; +} + +.header { + color: #bbbfc3; + font-size: 25px; + font-weight: 400; + text-transform: capitalize; + text-decoration: none; + text-shadow: 0 1px 0 white; +} + +.header-logo { + height: 50px; +} + +/* Body */ + +.body { + background-color: #ffffff; + border-bottom: 1px solid #edeff2; + border-top: 1px solid #edeff2; + margin: 0; + padding: 0; + width: 100%; + -premailer-cellpadding: 0; + -premailer-cellspacing: 0; + -premailer-width: 100%; +} +.company-name { + font-weight: 500; + margin-left: 4px; +} + +.inner-body { + background-color: #ffffff; + margin: 0 auto; + padding: 0; + width: 570px; + -premailer-cellpadding: 0; + -premailer-cellspacing: 0; + -premailer-width: 570px; +} + +/* Subcopy */ + +.subcopy { + margin-top: 25px; + padding-top: 25px; +} + +.subcopy p { + display: flex; + justify-content: center; + text-align: center; + font-size: 20px; +} + +/* Footer */ + +.footer { + margin: 0 auto; + padding: 0; + text-align: center; + width: 570px; + -premailer-cellpadding: 0; + -premailer-cellspacing: 0; + -premailer-width: 570px; +} + +.footer p { + color: #aeaeae; + font-size: 12px; + text-align: center; +} + +.footer-link { + text-decoration: none; + color: #5851D8; +} +/* Tables */ + +.table table { + margin: 30px auto; + width: 100%; + -premailer-cellpadding: 0; + -premailer-cellspacing: 0; + -premailer-width: 100%; +} + +.table th { + border-bottom: 1px solid #edeff2; + padding-bottom: 8px; + margin: 0; +} + +.table td { + color: #74787e; + font-size: 15px; + line-height: 18px; + padding: 10px 0; + margin: 0; +} + +.content-cell { + padding: 35px; +} + +/* Buttons */ + +.action { + margin: 30px auto; + padding: 0; + text-align: center; + width: 100%; + -premailer-cellpadding: 0; + -premailer-cellspacing: 0; + -premailer-width: 100%; +} + +.button { + border-radius: 3px; + box-shadow: 0 2px 3px rgba(0, 0, 0, 0.16); + color: #fff; + display: inline-block; + text-decoration: none; + -webkit-text-size-adjust: none; +} + +.button-blue, +.button-primary { + background-color: #5851D8; + border-top: 10px solid #5851D8; + border-right: 18px solid #5851D8; + border-bottom: 10px solid #5851D8; + border-left: 18px solid #5851D8; +} + +.button-green, +.button-success { + background-color: #38c172; + border-top: 10px solid #38c172; + border-right: 18px solid #38c172; + border-bottom: 10px solid #38c172; + border-left: 18px solid #38c172; +} + +.button-red, +.button-error { + background-color: #e3342f; + border-top: 10px solid #e3342f; + border-right: 18px solid #e3342f; + border-bottom: 10px solid #e3342f; + border-left: 18px solid #e3342f; +} + +/* Panels */ + +.panel { + margin: 0 0 21px; +} + +.panel-content { + background-color: #f1f5f8; + padding: 16px; +} + +.panel-item { + padding: 0; +} + +.panel-item p:last-of-type { + margin-bottom: 0; + padding-bottom: 0; +} + +/* Promotions */ + +.promotion { + background-color: #ffffff; + border: 2px dashed #9ba2ab; + margin: 0; + margin-bottom: 25px; + margin-top: 25px; + padding: 24px; + width: 100%; + -premailer-cellpadding: 0; + -premailer-cellspacing: 0; + -premailer-width: 100%; +} + +.promotion h1 { + text-align: center; +} + +.promotion p { + font-size: 15px; + text-align: center; +} diff --git a/resources/views/vendor/mail/text/button.blade.php b/resources/views/vendor/mail/text/button.blade.php new file mode 100644 index 00000000..97444ebd --- /dev/null +++ b/resources/views/vendor/mail/text/button.blade.php @@ -0,0 +1 @@ +{{ $slot }}: {{ $url }} diff --git a/resources/views/vendor/mail/text/footer.blade.php b/resources/views/vendor/mail/text/footer.blade.php new file mode 100644 index 00000000..3338f620 --- /dev/null +++ b/resources/views/vendor/mail/text/footer.blade.php @@ -0,0 +1 @@ +{{ $slot }} diff --git a/resources/views/vendor/mail/text/header.blade.php b/resources/views/vendor/mail/text/header.blade.php new file mode 100644 index 00000000..aaa3e575 --- /dev/null +++ b/resources/views/vendor/mail/text/header.blade.php @@ -0,0 +1 @@ +[{{ $slot }}]({{ $url }}) diff --git a/resources/views/vendor/mail/text/layout.blade.php b/resources/views/vendor/mail/text/layout.blade.php new file mode 100644 index 00000000..9378baa0 --- /dev/null +++ b/resources/views/vendor/mail/text/layout.blade.php @@ -0,0 +1,9 @@ +{!! strip_tags($header) !!} + +{!! strip_tags($slot) !!} +@isset($subcopy) + +{!! strip_tags($subcopy) !!} +@endisset + +{!! strip_tags($footer) !!} diff --git a/resources/views/vendor/mail/text/message.blade.php b/resources/views/vendor/mail/text/message.blade.php new file mode 100644 index 00000000..1ae9ed8f --- /dev/null +++ b/resources/views/vendor/mail/text/message.blade.php @@ -0,0 +1,27 @@ +@component('mail::layout') + {{-- Header --}} + @slot('header') + @component('mail::header', ['url' => config('app.url')]) + {{ config('app.name') }} + @endcomponent + @endslot + + {{-- Body --}} + {{ $slot }} + + {{-- Subcopy --}} + @isset($subcopy) + @slot('subcopy') + @component('mail::subcopy') + {{ $subcopy }} + @endcomponent + @endslot + @endisset + + {{-- Footer --}} + @slot('footer') + @component('mail::footer') + © {{ date('Y') }} {{ config('app.name') }}. @lang('All rights reserved.') + @endcomponent + @endslot +@endcomponent diff --git a/resources/views/vendor/mail/text/panel.blade.php b/resources/views/vendor/mail/text/panel.blade.php new file mode 100644 index 00000000..3338f620 --- /dev/null +++ b/resources/views/vendor/mail/text/panel.blade.php @@ -0,0 +1 @@ +{{ $slot }} diff --git a/resources/views/vendor/mail/text/promotion.blade.php b/resources/views/vendor/mail/text/promotion.blade.php new file mode 100644 index 00000000..3338f620 --- /dev/null +++ b/resources/views/vendor/mail/text/promotion.blade.php @@ -0,0 +1 @@ +{{ $slot }} diff --git a/resources/views/vendor/mail/text/promotion/button.blade.php b/resources/views/vendor/mail/text/promotion/button.blade.php new file mode 100644 index 00000000..aaa3e575 --- /dev/null +++ b/resources/views/vendor/mail/text/promotion/button.blade.php @@ -0,0 +1 @@ +[{{ $slot }}]({{ $url }}) diff --git a/resources/views/vendor/mail/text/subcopy.blade.php b/resources/views/vendor/mail/text/subcopy.blade.php new file mode 100644 index 00000000..3338f620 --- /dev/null +++ b/resources/views/vendor/mail/text/subcopy.blade.php @@ -0,0 +1 @@ +{{ $slot }} diff --git a/resources/views/vendor/mail/text/table.blade.php b/resources/views/vendor/mail/text/table.blade.php new file mode 100644 index 00000000..3338f620 --- /dev/null +++ b/resources/views/vendor/mail/text/table.blade.php @@ -0,0 +1 @@ +{{ $slot }} From 163a76cd377b585a9077d2f92c35918a36edc68c Mon Sep 17 00:00:00 2001 From: raishvaria Date: Tue, 19 Nov 2019 14:11:52 +0530 Subject: [PATCH 8/8] change url of onboarding --- resources/assets/js/views/wizard/EmailConfiguration.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/assets/js/views/wizard/EmailConfiguration.vue b/resources/assets/js/views/wizard/EmailConfiguration.vue index 17dc917b..a273ace5 100644 --- a/resources/assets/js/views/wizard/EmailConfiguration.vue +++ b/resources/assets/js/views/wizard/EmailConfiguration.vue @@ -59,7 +59,7 @@ export default { async next (mailConfigData) { this.loading = true try { - let response = await window.axios.post('/api/settings/environment/mail', mailConfigData) + let response = await window.axios.post('/api/admin/onboarding/environment/mail', mailConfigData) if (response.data.success) { this.$emit('next') window.toastr['success'](this.$t('wizard.success.' + response.data.success))