final commit
This commit is contained in:
@@ -13,6 +13,7 @@ use App\Model\helpdesk\Utility\Languages;
|
||||
use Illuminate\Http\Request;
|
||||
use Mail;
|
||||
use Exception;
|
||||
use Input;
|
||||
|
||||
/**
|
||||
* TemplateController
|
||||
@@ -101,6 +102,65 @@ class TemplateController extends Controller {
|
||||
* @param type Languages $language
|
||||
* @return type Response
|
||||
*/
|
||||
public function listtemplates() {
|
||||
$path = '../resources/views/emails/';
|
||||
|
||||
$templates = scandir($path);
|
||||
$directory = str_replace('/', '-', $path);
|
||||
return view('themes.default1.admin.helpdesk.emails.template.listtemplates', compact('templates','directory'));
|
||||
}
|
||||
|
||||
public function readtemplate($template,$path) {
|
||||
$directory = str_replace('-', '/', $path);
|
||||
$directory2 = $directory.$template;
|
||||
if (is_dir($directory2)) {
|
||||
$templates = scandir($directory2);
|
||||
$directory = str_replace('/', '-', $directory2.'/');
|
||||
return view('themes.default1.admin.helpdesk.emails.template.listtemplates', compact('templates','directory'));
|
||||
}
|
||||
else {
|
||||
$handle = fopen($directory.$template, "r");
|
||||
$contents = fread($handle, filesize($directory.$template));
|
||||
fclose($handle);
|
||||
}
|
||||
return view('themes.default1.admin.helpdesk.emails.template.readtemplates', compact('contents','template','path'));
|
||||
}
|
||||
public function createtemplate() {
|
||||
$directory = '../resources/views/emails/';
|
||||
$fname = Input::get('folder_name');
|
||||
$filename = $directory.$fname;
|
||||
|
||||
// images folder creation using php
|
||||
// $mydir = dirname( __FILE__ )."/html/images";
|
||||
// if(!is_dir($mydir)){
|
||||
// mkdir("html/images");
|
||||
// }
|
||||
// Move all images files
|
||||
|
||||
if(!file_exists($filename)) {
|
||||
mkdir($filename,0777);
|
||||
}
|
||||
$files = array_filter(scandir($directory.'default'));
|
||||
|
||||
foreach($files as $file){
|
||||
if ($file === '.' or $file === '..') continue;
|
||||
if(!is_dir($file)) {
|
||||
// $file_to_go = str_replace("code/resources/views/emails/",'code/resources/views/emails/'.$fname,$file);
|
||||
$destination = $directory.$fname.'/';
|
||||
|
||||
copy($directory.'default/'.$file, $destination.$file);
|
||||
}
|
||||
}
|
||||
return \Redirect::back()->with('success', 'Successfully copied');
|
||||
}
|
||||
public function writetemplate($template,$path) {
|
||||
$directory = str_replace('-', '/', $path);
|
||||
$b = Input::get('templatedata');
|
||||
|
||||
file_put_contents($directory.$template, print_r($b, true));
|
||||
return \Redirect::back()->with('success', 'Successfully updated');
|
||||
}
|
||||
|
||||
public function edit($id, Template $template, Languages $language) {
|
||||
try {
|
||||
$templates = $template->whereId($id)->first();
|
||||
|
@@ -28,7 +28,8 @@ use Schedule;
|
||||
use File;
|
||||
use Artisan;
|
||||
use Exception;
|
||||
|
||||
$root = realpath($_SERVER["DOCUMENT_ROOT"]);
|
||||
include_once($root.'\vendor\phpmailer\phpmailer\PHPMailerautoload.php');
|
||||
/**
|
||||
* MailController
|
||||
*
|
||||
@@ -51,6 +52,39 @@ class MailController extends Controller {
|
||||
* Reademails
|
||||
* @return type
|
||||
*/
|
||||
public function sendmail() {
|
||||
$mail = new \PHPMailer;
|
||||
|
||||
//$mail->SMTPDebug = 3; // Enable verbose debug output
|
||||
|
||||
$mail->isSMTP(); // Set mailer to use SMTP
|
||||
$mail->Host = 'smtp.gmail.com'; // Specify main and backup SMTP servers
|
||||
$mail->SMTPAuth = true; // Enable SMTP authentication
|
||||
$mail->Username = 'sujitprasad4567@gmail.com'; // SMTP username
|
||||
$mail->Password = 'pankajprasad22.'; // SMTP password
|
||||
$mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted
|
||||
$mail->Port = 587; // TCP port to connect to
|
||||
|
||||
$mail->setFrom('sujitprasad4567@gmail.com', 'Mailer');
|
||||
$mail->addAddress('sada059@gmail.com', 'Joe User'); // Add a recipient
|
||||
// Name is optional
|
||||
$mail->addReplyTo('sada059@gmail.com', 'Information');
|
||||
|
||||
|
||||
// Optional name
|
||||
$mail->isHTML(true); // Set email format to HTML
|
||||
|
||||
$mail->Subject = 'Here is the subject';
|
||||
$mail->Body = 'This is the HTML message body <b>in bold!</b>';
|
||||
$mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
|
||||
|
||||
if(!$mail->send()) {
|
||||
echo 'Message could not be sent.';
|
||||
echo 'Mailer Error: ' . $mail->ErrorInfo;
|
||||
} else {
|
||||
echo 'Message has been sent';
|
||||
}
|
||||
}
|
||||
public function readmails(Emails $emails, Email $settings_email, System $system)
|
||||
{
|
||||
// $path_url = $system->first()->url;
|
||||
|
@@ -17,6 +17,8 @@ use Illuminate\Foundation\Auth\AuthenticatesAndRegistersUsers;
|
||||
use Mail;
|
||||
use Auth;
|
||||
use Exception;
|
||||
$root = realpath($_SERVER["DOCUMENT_ROOT"]);
|
||||
include_once($root.'\faveo-comm\vendor\phpmailer\phpmailer\PHPMailerautoload.php');
|
||||
|
||||
/**
|
||||
* ---------------------------------------------------
|
||||
@@ -103,7 +105,40 @@ class AuthController extends Controller {
|
||||
});
|
||||
return redirect('home')->with('success', 'Activate Your Account ! Click on Link that send to your mail');
|
||||
}
|
||||
|
||||
public function sendmail() {
|
||||
$mail = new \PHPMailer;
|
||||
|
||||
//$mail->SMTPDebug = 3; // Enable verbose debug output
|
||||
|
||||
$mail->isSMTP(); // Set mailer to use SMTP
|
||||
$mail->Host = 'smtp.gmail.com'; // Specify main and backup SMTP servers
|
||||
$mail->SMTPAuth = true; // Enable SMTP authentication
|
||||
$mail->Username = 'sujitprasad4567@gmail.com'; // SMTP username
|
||||
$mail->Password = 'pankajprasad22.'; // SMTP password
|
||||
$mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted
|
||||
$mail->Port = 587; // TCP port to connect to
|
||||
|
||||
$mail->setFrom('sujitprasad4567@gmail.com', 'Mailer');
|
||||
$mail->addAddress('sada059@gmail.com', 'Joe User'); // Add a recipient
|
||||
// Name is optional
|
||||
$mail->addReplyTo('sada059@gmail.com', 'Information');
|
||||
|
||||
|
||||
// Optional name
|
||||
$mail->isHTML(true); // Set email format to HTML
|
||||
|
||||
$mail->Subject = 'Here is the subject';
|
||||
$mail->Body = 'This is the HTML message body <b>in bold!</b>';
|
||||
$mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
|
||||
|
||||
if(!$mail->send()) {
|
||||
echo 'Message could not be sent.';
|
||||
echo 'Mailer Error: ' . $mail->ErrorInfo;
|
||||
} else {
|
||||
echo 'Message has been sent';
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Get mail function
|
||||
* @param type $token
|
||||
|
@@ -58,7 +58,10 @@ Route::group(['middleware' => 'roles', 'middleware' => 'auth'], function () {
|
||||
Route::resource('banlist', 'Admin\helpdesk\BanlistController'); // in banlist module, for CRUD
|
||||
|
||||
Route::resource('template', 'Admin\helpdesk\TemplateController'); // in template module, for CRUD
|
||||
|
||||
Route::get('list-templates', 'Admin\helpdesk\TemplateController@listtemplates');
|
||||
Route::get('read-templates/{template}/{directory}',['as'=>'template.read','uses'=>'Admin\helpdesk\TemplateController@readtemplate']);
|
||||
Route::patch('write-templates/{contents}/{directory}',['as'=>'template.write','uses'=>'Admin\helpdesk\TemplateController@writetemplate']);
|
||||
Route::post('create-templates',['as'=>'template.createnew','uses'=>'Admin\helpdesk\TemplateController@createtemplate']);
|
||||
Route::get('getdiagno', 'Admin\helpdesk\TemplateController@formDiagno'); // for getting form for diagnostic
|
||||
|
||||
Route::post('postdiagno', 'Admin\helpdesk\TemplateController@postDiagno'); // for getting form for diagnostic
|
||||
|
Reference in New Issue
Block a user