-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
rajakodings
committed
May 25, 2019
0 parents
commit 1eef908
Showing
10 changed files
with
234 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
/vendor/ | ||
/.idea | ||
_config.yml | ||
composer.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2018 Crocodic Studio | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Email Tester For Laravel | ||
|
||
Debugging send the email is never been easy. With this library you can debug and check your email smtp problem. | ||
|
||
## How to install | ||
Install this library with command : | ||
|
||
<code>composer require crocodicstudio/emailtester</code> | ||
|
||
Recommended laravel version 5.7 up . If you use 5.4 or bellow you have to add service provider manually | ||
|
||
<code>crocodicstudio/emailtester/EmailTesterServiceProvider::class</code> to config/app.php (Providers section) | ||
|
||
## How to use | ||
|
||
Just visit the url /email-tester at the browser. | ||
|
||
# How to disable | ||
|
||
To disable this email tester, you can add <code>EMAIL_TESTER=false</code> to your .env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{ | ||
"name": "crocodicstudio/email-tester", | ||
"description": "SMTP Email tester and debug for Laravel", | ||
"type": "library", | ||
"license": "MIT", | ||
"authors": [ | ||
{ | ||
"name": "Ferry Ariawan", | ||
"email": "ferry@crocodic.com" | ||
} | ||
], | ||
"minimum-stability": "dev", | ||
"require": { | ||
"php": ">5.6", | ||
"laravel/laravel":"^5.4" | ||
}, | ||
"autoload": { | ||
"psr-0": { | ||
"crocodicstudio\\emailtester": "src/" | ||
} | ||
}, | ||
"extra": { | ||
"laravel": { | ||
"providers": [ | ||
"crocodicstudio\\emailtester\\EmailTesterServiceProvider" | ||
] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<?php | ||
|
||
namespace crocodicstudio\emailtester\controllers; | ||
|
||
use Illuminate\Routing\Controller as BaseController; | ||
use Illuminate\Support\Facades\Config; | ||
use Illuminate\Support\Facades\Mail; | ||
|
||
class EmailTesterController extends BaseController | ||
{ | ||
|
||
public function getIndex() | ||
{ | ||
return view("emailtester::email_form"); | ||
} | ||
|
||
public function postSend() | ||
{ | ||
Config::set('mail.driver',request("driver")); | ||
Config::set('mail.host',request('hostname')); | ||
Config::set('mail.port', request('port')); | ||
if(request('encryption')) { | ||
Config::set('mail.encryption',request('encryption')); | ||
} | ||
|
||
Config::set('mail.username',request('username')); | ||
Config::set('mail.password',request('password')); | ||
|
||
$logger = new \Swift_Plugins_Loggers_ArrayLogger(); | ||
Mail::getSwiftMailer()->registerPlugin(new \Swift_Plugins_LoggerPlugin($logger)); | ||
|
||
$data['debug'] = ""; | ||
|
||
try{ | ||
Mail::send("crudbooster::emails.blank",['content'=>request('content')],function($message) { | ||
$message->priority(1); | ||
$message->to(request('to')); | ||
$message->from("email-tester@".$_SERVER['SERVER_NAME'],"Email Tester Agent"); | ||
$message->subject(request("subject")); | ||
}); | ||
}catch(\Swift_TransportException $e) { | ||
// $data['debug'] .= $e->getMessage(); | ||
} | ||
|
||
|
||
$data['debug'] .= $logger->dump(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php | ||
namespace crocodicstudio\emailtester; | ||
|
||
use Illuminate\Support\ServiceProvider; | ||
|
||
class EmailTesterServiceProvider extends ServiceProvider | ||
{ | ||
/** | ||
* Bootstrap the application services. | ||
* | ||
* @return void | ||
*/ | ||
|
||
public function boot() | ||
{ | ||
$this->loadViewsFrom(__DIR__.'/Views', 'emailtester'); | ||
|
||
require __DIR__.'/Routes/route.php'; | ||
} | ||
|
||
/** | ||
* Register the application services. | ||
* | ||
* @return void | ||
*/ | ||
public function register() | ||
{ | ||
require __DIR__.'/Helpers/Helper.php'; | ||
|
||
|
||
$this->app->singleton('emailtester', function () { | ||
return true; | ||
}); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
|
||
namespace Crocodicstudio\Cbmodel\Helpers; | ||
|
||
use Illuminate\Support\Facades\DB; | ||
|
||
class Helper | ||
{ | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?php | ||
|
||
use Illuminate\Support\Facades\Route; | ||
|
||
if(env("EMAIL_TESTER", true)===true) { | ||
Route::group([ | ||
'middleware' => ['web'], | ||
'prefix' => "/", | ||
'namespace' => 'crocodicstudio\emailtester\controllers', | ||
], function () { | ||
Route::get("email-tester", "EmailTesterController@getIndex"); | ||
Route::post("email-tester", "EmailTesterController@postSend"); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{!! $content !!} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<html> | ||
<head> | ||
<title>Email Tester For Laravel</title> | ||
</head> | ||
<body> | ||
<h2>Email Tester For Laravel</h2> | ||
<form action="" method="post"> | ||
{!! csrf_field() !!} | ||
<table width="500px" border="1px"> | ||
<tr> | ||
<td>Driver</td><td><input type="text" name="driver" size="90" value="{{ request('driver')?:'smtp' }}" required ></td> | ||
</tr> | ||
<tr> | ||
<td>Hostname</td><td><input type="text" name="hostname" size="90" value="{{ request('hostname') }}" required ></td> | ||
</tr> | ||
<tr> | ||
<td>Username</td><td><input type="text" name="username" size="90" value="{{ request('username') }}" required ></td> | ||
</tr> | ||
<tr> | ||
<td>Password</td><td><input type="text" name="password" size="90" value="{{ request('password') }}" required ></td> | ||
</tr> | ||
<tr> | ||
<td>Port</td><td><input type="text" name="port" size="40" value="{{ request('port')?:587 }}" required ></td> | ||
</tr> | ||
<tr> | ||
<td>Encryption</td><td><input type="text" name="encryption" size="40" value="{{ request('encryption')?:"tls" }}" ></td> | ||
</tr> | ||
<tr> | ||
<td>To</td><td><input type="text" name="to" size="90" value="{{ request('to') }}" required ></td> | ||
</tr> | ||
<tr> | ||
<td>Subject</td><td><input type="text" name="subject" size="90" value="{{ request('subject')?:'Thank you for using this email tester' }}" required ></td> | ||
</tr> | ||
<tr> | ||
<td>Message</td><td><input type="text" name="content" size="90" value="{{ request('content')?:'Hi there, Congratulation the email has been received successfully' }}" required ></td> | ||
</tr> | ||
<tr> | ||
<td> </td><td><input type="submit" value="Submit"></td> | ||
</tr> | ||
</table> | ||
</form> | ||
|
||
@if(isset($debug)) | ||
<pre> | ||
{!! $debug !!} | ||
</pre> | ||
@endif | ||
</body> | ||
</html> | ||
|
||
|