This commit is contained in:
Sada Shiva
2016-02-05 12:26:28 +05:30
parent 5275e7a650
commit 2018740963
3 changed files with 127 additions and 71 deletions

View File

@@ -20,7 +20,7 @@ use App\Model\helpdesk\Ticket\Tickets;
use PhpImap\Mailbox as ImapMailbox;
use PhpImap\IncomingMail;
use PhpImap\IncomingMailAttachment;
use \ForceUTF8\Encoding;
use ForceUTF8\Encoding;
use App;
use DB;
use Crypt;
@@ -28,8 +28,9 @@ use Schedule;
use File;
use Artisan;
use Exception;
$root = realpath($_SERVER["DOCUMENT_ROOT"]);
include_once($root.'\vendor\phpmailer\phpmailer\PHPMailerautoload.php');
use Phpmailer\PHPMailerautoload;
//$root = realpath($_SERVER["DOCUMENT_ROOT"]);
//include_once($root.'\vendor\phpmailer\phpmailer\PHPMailerautoload.php');
/**
* MailController
*
@@ -52,39 +53,8 @@ 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;

View File

@@ -17,8 +17,7 @@ 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');
/**
* ---------------------------------------------------
@@ -106,39 +105,7 @@ 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

View File

@@ -0,0 +1,119 @@
<?php
namespace App\Http\Controllers;
use App\Http\Requests;
use App\Http\Controllers\Controller;
use Phpmailer\PHPMailerautoload;
use Illuminate\Http\Request;
class PhpMailController extends Controller {
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index() {
//
}
/**
* Sending emails from the system.
*
* @return Mail
*/
public function sendmail($host = '', $username = '', $password = '', $smtpsecure = '', $port = '', $from = '', $recipants = '', $subject = '', $body = '', $cc = '', $bc = '') {
$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';
}
}
/**
* Show the form for creating a new resource.
*
* @return Response
*/
public function create() {
//
}
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function store() {
//
}
/**
* Display the specified resource.
*
* @param int $id
* @return Response
*/
public function show($id) {
//
}
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return Response
*/
public function edit($id) {
//
}
/**
* Update the specified resource in storage.
*
* @param int $id
* @return Response
*/
public function update($id) {
//
}
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return Response
*/
public function destroy($id) {
//
}
}