Skip to main content

Posts

Showing posts from May, 2016

Solved-mail not send gmail smtp phpmailer

Solved-mail not send with phpmailer if you face problem to send mail from your localhost or live server you can use this code to solve your problem. function SendMail( $ToEmail,$subjectval, $MessageHTML, $MessageTEXT ) {      // require_once ( 'class.phpmailer.php' ); // Add the path as appropriate      include_once "webroot/phpmailer/PHPMailerAutoload.php";       $Mail = new PHPMailer();       $Mail->IsSMTP(); // Use SMTP       $Mail->Host        = "smtp.gmail.com"; // Sets SMTP server       $Mail->SMTPDebug   = 0; // 2 to enable SMTP debug information       $Mail->SMTPAuth    = TRUE; // enable SMTP authentication       $Mail->SMTPSecure  = "tls"; //Secure conection       $Mail->Port        = 587; // set the SMTP port       $Mail->Username    = 'yourmailaddress@gmail.com'; // SMTP account username       $Mail->Password    = 'yourpassword'; // SMTP account password       $Mail->Priority   

Send mail from localhost using phpmailer

 How to Send mail from localhost using phpmailer   To send mail from your localhost or live server you can use phpmailer class. phpmailer class sends mail using smtp from both local and live server .using phpmailer you can also send html. so these are the steps to send a mail from localhost using phpmailer. Step 1 First download phpmailer class from here . and after download unzip and extract it into your root directory ex(htdocs/yourprojectfolder/phpmailer/). Step 2 then create a form in your html to send mail    <form action="" method="post" onsubmit="return sendnewsletter()">                                                       <div class="form-body">                                 <div class="form-group">                                     <div class="msgalert"><?php echo isset($msgshow)?$msgshow:""; ?></div>                                  </div>       

Simple n secure data Encryption and Decryption function using php

Simple Encryption and decryption function in php we use mcrypt php function to encrypt a string and decrpyt the same string.so these are the function to encypt and decrypt a string in php. Php function to encrypt a string.  public function encryptHash($value)       {         $key = 'wt1U5qZAWJFYUGenFoMOiLwQrGLgdbHA';         $iv = mcrypt_create_iv(                 mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_CBC),                 MCRYPT_DEV_URANDOM             );             $encrypted = base64_encode(                 $iv .                 mcrypt_encrypt(                     MCRYPT_RIJNDAEL_128,                     hash('sha256', $key, true),                     $value,                     MCRYPT_MODE_CBC,                     $iv                 )             );             return $encrypted;         /*             $key = ' wt1U5qZAWJFYUGenFoMOiLwQrGLgdbHA '; //wt1U5MACWJFTXGenFoZoiLwQGrLgdbHA             $result = Security::encrypt($value, $key);

All Html Special symbols code and ASCII code

All Html Special symbols code and ASCII code these are the all html special symbols  html code and ascii code .

Get user country and ip php and Cakephp

Get user country and ip php and Cakephp  Cakephp function to get ip and country of user public function getUserIpLocation()       {              $uinfo['userip'] = $this->request->clientIp();              $userip = $this->request->clientIp();                            $details = @json_decode(file_get_contents("http://freegeoip.net/json/".$userip));              $uinfo['usercountry'] = $details->country_name;              if($uinfo['usercountry']=="") { $uinfo['usercountry']="Unknown"; }              return $uinfo;       } Php Function to get user ip and country public function getUserIpLocation()       {              $uinfo['userip'] = $_SERVER['REMOTE_ADDR']              $userip = $this->request->clientIp();                            $details = @json_decode(file_get_contents("http://freegeoip.net/json/".$userip));              $uinfo['usercountry'] = $det

enable 2fa 2 step login authentication in cakephp 3

How to use 2fa google authentication  in cakephp 3 and above What is google authentication or 2 step verification google authentication or 2 step verification provide security to user account and enable 2 step security on thier account.user need to always insert a unique code generated by their phone app to login in thier account. this will prevent others to access their account even they have users login details. this tutorial will allow user to enable 2 factor google verfication into their accounts .and after this code user needs to follow these steps * click on enable 2fa link * download authi or google authenticator app * after click on enable 2fa link user able to view a page with a qr code and a key. user need to read qr code or enter key manually into their phone app . * and get a code from their phone and insert this code into the code field on same page.and if code is right then user 2fa google authentication or 2 step verificaiton will enabled for thier account.

Send mail using mail class in cakephp 3

Send mail using gmail smtp cakephp 3 to send mail using gmail in cakephp you nedd to follow these steps 1. open your yourproject/config/app.php 2. in your app.php replace 'EmailTransport' => [         'default' => [             'className' => 'Mail',             // The following keys are used in SMTP transports             'host' => 'localhost',             'port' => 25,             'timeout' => 30,             'username' => 'user',             'password' => 'secret',             'client' => null,             'tls' => null,             'url' => env('EMAIL_TRANSPORT_DEFAULT_URL', null),         ],         to this code  'EmailTransport' => [         'default' => [             'className' => 'Mail',             // The following keys are used in SMTP transports