Sunday, 13 December 2015

Sending E MAIL using PHPMailer

Download the PHPMailer from the website before proceeding : https://github.com/PHPMailer/PHPMailer

Extract the ZIP file and keep in the same location where our sendMail.php residing ( the apache/xampp default location) and

Now here is the sendMail.php , copy the below code and paste it in a file,name the file as sendMail.php. Change the Mail domain name, username and passwords respectively at the locations given and run the program using the command

> php sendMail.php

Then check the output in your inbox.


<?php
                                           /* Send Mail through PHP code */
try{
require_once('PHPMailer/class.phpmailer.php');

$mail = new PHPMailer();
// Dialog::message('Mail', "Mail object created with $this->email");
// $uname=Yii::app()->user->name;  No need if this is not a webapplication ( The logged in username say example, Admin)
$mail->IsSMTP();
$mail->CharSet="UTF-8";
$mail->SMTPSecure = 'ssl';
$mail->Host = 'mail.domain.in';
$mail->Port = 465;
$mail->Username = 'username@domain.in';
$mail->Password = 'password@123';
$mail->SMTPAuth = true;
$mail->From = 'username@domain.in';
$mail->FromName = "Email";
$mail->AddAddress('username@domain.in');

$mail->AddReplyTo("Someone@domain.in", "someone");
//$ipadd=Yii::app()->request->userHostAddress;
$ipadd=null;
$mail->IsHTML(true);
$mail->Subject = "Testing the mail service";
$mail->AltBody = "Mail From Server. To view the message, please use an HTML compatible email viewer!";
$mail->Body = "From Email : username@domain.in <br/> Logged in Application as <b>Admin</b>";


if(($ipadd!=null)and($ipadd!='')) {
// $mail->Body= $mail->Body." through Ip address $ipadd<br/> Content: ".$this->body;
$mail->Body= $mail->Body." through Ip address $ipadd<br/> Content: Testing the application using XAMPP";
}
else {
// $mail->Body= $mail->Body."<br/> Content: ".$this->body;
$mail->Body= $mail->Body."<br/> Content: Test mail from the XAMPP server code";
}
if(!$mail->Send())
{
 echo "<h1>"."Mailer Error: " . $mail->ErrorInfo."</h1>";
 exit(0);
}
else
{
 echo "<h1>Mail sent Successfully!</h1>";
}
     }catch(Exception $e){
        echo 'caught exception:',$e->getMessage();
     }

     ?>

Thursday, 10 December 2015

Got Error "C:\users\..\AppData\Local\Temp;c:" while installing a software

err.jpg
If you encounter the above error while installing a software, Do the following steps:
The above error encounters when the user defined environment variable "TEMP" is updated. For example, If we installed JDK , the main important part after installing JDK is setting PATH .. somehow, for some need we need to set TEMP variable also, In that case, this TEMP variable creates the error while installing since the ":" is not allowed in the folder names and here in path we have a ';' followed by 'C:' generates a windows error 
Your %TEMP% environment variable is screwy.  Do this:
- Open Control Panel
- System
- Advanced System Settings
- Environment Variables
- In the User Variables, select TEMP and click Edit
- Remove the semi-colon (;) and everything after it
- OK your way out of all the dialogs
- Try installing Software again
Hope this helps!!!

Monday, 23 November 2015

Install Google Chrome in UBUNTU

If it is 64 bit OS follow the below steps

wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add - 
sudo sh -c 'echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list'
sudo apt-get update 
sudo apt-get install google-chrome-stable 
 
 
For 32-bit systems user can use this code:

sudo apt-get install libxss1 libappindicator1 libindicator7 
wget https://dl.google.com/linux/direct/google-chrome-stable_current_i386.deb 
sudo dpkg -i google-chrome*.deb 
 
If error messages pop up after running the command
sudo dpkg -i google-chrome*.deb

then run the command

sudo apt-get install -f 
 
and then re-run the previous command. The error messages mentioned should include something similar to

google-chrome-stable depends on [lib-example]; however; Package [lib-example] is not installed. 
 
This installs a needed library for Google Chrome, then downloads the latest version of Chrome to a temporary directory and installs it. Run google-chrome to start the browser.
During the installation a PPA is added to your system so that Google Chrome receives the latest updates whenever you check for system updates.

Friday, 13 November 2015

Install Sublime editor in ubuntu

Type the following commands in the terminal, for Sublime Text 2 :

sudo add-apt-repository ppa:webupd8team/sublime-text-2
sudo apt-get update
sudo apt-get install sublime-text
 
For Sublime Text 3 :

sudo add-apt-repository ppa:webupd8team/sublime-text-3
sudo apt-get update
sudo apt-get install sublime-text-installer

Saturday, 31 October 2015

Start XAMPP Server automatically on windows Startup

Follow the Steps:-

1) First you need to configure your xampp setting. RUN XAMPP and follow image.



2) Now, to run any exe at the start up. Windows need to see the Run log. Exe file present in the RUN.log windows runs those files.

3) So to start Xampp. We have to make its log in RUN.

4) windows + R (i.e Open RUN) type REGEDIT >HKEY_LOCAL_MACHINE>SOFTWARE>
     MICROSOFT>WINDOWS>CURRENT VISION>RUN.






5)Now right click in window> NEW>STRING VALUE or alt+ E > NEW>STRING VALUE. it will add new file in list. name it by XAMPP. 

6) Right Click on this File. Select MODIFY> in String Data field type path of xampp_start.exe
c:\xampp\xampp_start.exe > click on ok.






7) Now LOG OFF . Again on LOG ON you will find your Xampp started automatically.


8) It will now even show any xampp window running or minimized.  Check it by running  any PHP file in browser.