Thursday 30 July 2015

Basic Linux Commands

Linux Basic Commands

1.ls

     listing directories.

2.rm

     unlink a file or directory.
     ex :rm /home/riyas/openerp/14-5-2015_order_type.tar.gz

3.cd ..

     for getting back to a parent directory.
     /home/riyas/openerp/14-5-2015_order_type/order_type suppose this our current direcory

     then open a terminal and type cd .. then
     /home/riyas/openerp/14-5-2015_order_type

4.reset

   its for reseting the command prompt.
  every thing will be clear.



5.exit

  for closing a terminal.


6.ctrl + alt +delete


  short cut for logout

7.any_command -help |more

  Display a brief help on a commands.


8)help


  Display brief info on a bash (shell) built-in commands.

9)pwd


  Print working directory,

10)hostname


  Print the name of the local host

11)whoami

   Print my login name

12)date

   Print the operating system current date

13)who

   Determine the users logged on the machine.

14)w

  Determine who is logged on the system, find out what they are doing, their processor ussage, etc. Handy security command

15)last

   Show listing of users last logged-in on your system. Really good idea to check it from time to time as a security measure on your system.

16)history | more

   Show the last (1000 or so) commands executed from the command line on the current account.


17)comman

  Run the most recent command from my bash history commands that starts with the string "comman"

18) uptime

 Show the amount of time since the last reboot.


19)ps axu | more

    List all the processes currently running, even those without the controlling terminal, together with the name of the user that owns each process.

20)top

   Keep listing the currently running processes on my computer, sorted by cpu usage (top processes first). Press <Ctrl>c when done.

21)free

   Memory info (in kilobytes). "Shared" memory is the memory that can be shared between processes (e.g., executable code is "shared"). "Buffered" and "cashed" memory is the part that keeps parts of recently accessed files - it can be shrunk if more memory is needed by processes.

22)cat /proc/cpuinfo

  Cpu info - shows the content of the file cpuinfo.

23)cat /proc/interrupts

  List the interrupts in use. May need to find out before setting up new hardware.

24)cat /proc/version

   Linux version and other info.

25)cat /proc/filesystems

   Show the types of filesystems currently in use.


26)lsmod

    Show the kernel modules currently loaded.

27)set|more

   Show the current user environment (in full). Normally too much to bother.


28)Copy

scp -r admin@192.3.1.25:/opt/erp/test /home/riyas/Desktop/test


Wednesday 29 July 2015

BZR Configuration

BZR Configuration

       ssh admin@192.168.1.99
       Log to server
       cd /opt/bzr_repository
       bzr init sale
       checkout to your local
       bzr checkout sftp://admin@192.168.1.99/opt/bzr_repository/sale sale 
       Add files
       bzr add
       bzr commit -m "fisrt commit"
       
       agian log to server
       open customized_addone
       bzr checkout sftp://admin@192.168.1.99/opt/bzr_repository/sale sale 
       if again committing 
       open the sale module 
       bzr pull
       

       


Tuesday 28 July 2015

Git configuration for project revisions

1. Git repository maintaining our own server

   Inside the server we have odoo(base) code,our customized_addone,create     
   another folder git_repository(whatever name you can give).

   open the git_repository and start a module using this command.

   sudo get init --bare driver_roster.git
   sudo chmod 777 -R customized_addone/   for permission
   sudo chmod 777 -R git_repository/   for permission

   then you started a repository for the module driver_roster
   checkout this one to your local using this command

   git clone riyas@192.168.1.123:/opt/server/git_repository /driver_roster.git
   add files to it
   suppose you added __init__.py,__openerp__.py
   if you want to remove the .pyc,files tilde files use the command.

   echo "* .pyc" > .gitignore
   echo "* ~" > .gitignore

   git add .(for adding files to it)
   git commit -m "first commit"

   git push origin master

   again open the server
   sudo git clone file:////opt/git_repository/driver_roster.git
   this you are done.
   if you again need to update changes
   just commit and go to server and type git pull.
  



2.Using bitbucket.com,github.com


 first create a account and create a repository using bitbucket.com,github.com.

 git clone https://riyas100@bitbucket.org/riyas100/driver_roster.git
 then git add .
 git commit -m "message"
 git push origin master

 then clone any where using the git clone https://riyas100@bitbucket.org/riyas100/driver_roster.git
 git pull

Search View Filters In Odoo

Hi All,


Filters for Datetime field


Today Filter

<filter icon="terp-go-month" string="Today " separator="1" domain="[('date','&lt;=', (datetime.date.today()).strftime('%Y-%m-%d')),('date','&gt;=',(datetime.date.today()).strftime('%Y-%m-%d'))]" help="Created today"/>
                                    OR

<filter icon="terp-go-today" string="Today" domain="[('date','&lt;=', datetime.datetime.combine(context_today(), datetime.time(23,59,59))), ('date','&gt;=', datetime.datetime.combine(context_today(), datetime.time(0,0,0)))]" help="Orders processed Today or planned for Today"/>


This Year


<filter string="This Year" name="year" domain="[('date','&lt;=', time.strftime('%%Y-12-31')),('date','&gt;=',time.strftime('%%Y-01-01'))]"/>




Last Week

<filter string="Last week" domain="[('date_order', '&gt;=', ((context_today()+relativedelta(weeks=-2,                                         days=1, weekday=0)).strftime('%Y-%m-%d'))),('date_order', '&lt;=', ((context_today()+relativedelta(weeks=-1,weekday=6)).strftime('%Y-%m-%d')))]"/>


This Month 

  <filter icon="terp-go-month" string="Month" name="month" domain="[('date_order','&lt;=',(datetime.date.today()+relativedelta(day=31)).strftime('%Y-%m-%d')),('date_order','&gt;=',(datetime.date.today()-relativedelta(day=1)).strftime('%Y-%m-%d'))]" help="Current Month"/>



Current week


<filter icon="terp-go-week"
        string="Current Week"
        separator="1"
        name="week"
        domain="[('date_order','&lt;=', (context_today() + relativedelta(weeks=0,day=7, weekday=-1)).strftime('%Y-%m-%d')),('date_order','&gt;=',(context_today() - relativedelta(weeks=1, weekday=0)).strftime('%Y-%m-%d'))]"
        help="Current Week"
        context="{'group_by':'date_order'}"/>


Previous Month


<filter string="Prev Month" name="prev_month" domain="[('date_order','&gt;=',(context_today()-relativedelta(months=1)).strftime('%Y-%m-01')),('date_order','&lt;',time.strftime('%Y-%m-01'))]"/>


Expiry checking


<filter string="Immediate Expiry" name="od_imm" domain="[('expiry_date','&gt;=', ((context_today()+datetime.timedelta(days=1)).strftime('%Y-%m-%d'))),('expiry_date','&lt;=', ((context_today()+datetime.timedelta(days=45)).strftime('%Y-%m-%d')))]"/>

Yesterday


<filter string="Yesterday" domain="[('date_order','&gt;=', ((context_today()-datetime.timedelta(days=1)).strftime('%Y-%m-%d 00:00:00'))), ('date_order','&lt;=', ((context_today()+datetime.timedelta(days=0)).strftime('%Y-%m-%d 00:00:00')))]"/>

Tomorrow


<filter string="Tomorrow" domain="[('date_order','&gt;=', ((context_today()+datetime.timedelta(days=0)).strftime('%Y-%m-%d 23:59:59'))), ('date_order','&lt;=', ((context_today()+datetime.timedelta(days=1)).strftime('%Y-%m-%d 23:59:59')))]"/>

Filters for Selection Field


Eg:<filter string="Quotations" name="draft" domain="[('state','in',('draft','sent'))]" help="Sales Order that haven't yet been confirmed"/>
Eg:<filter string="To Invoice" domain="[('state','=','manual')]" help="Sales Order ready to be invoiced"/>


Filters for Boolean Field


Eg:<filter icon="terp-gtk-jump-to-ltr" string="To Review" domain="[('to_check','=',True)]" help="Journal Entries to Review"/>

Filters for Many2one Field


<filter domain="[('user_id','=',uid)]" help="My Invoices" string="My Invoices"/>
for many2one field we are usually adding group by instead of filters.
you can add filters for many2one field by hard coding ids

Eg:-<filter domain="[('partner_id','in',(1,2,9,8,22)]" help="Selected" string="Special Partners"/>
Eg:-<filter domain="[('partner_id','=',1]" help="Selected" string="My Order"/>



Filters for Date Field

 

 

This week



<filter string="This Week"  name="This Week" separator="1"
                         domain="[('date_from','&gt;=', ((context_today()).strftime('%Y-%m-%d'))), ('date_from','&lt;=', ((context_today()+datetime.timedelta(days=7)).strftime('%Y-%m-%d')))]"
                           help="This Week"/>


Last Week



<filter string="Last Week"  name="Last Week" separator="1"
                         domain="[('date_from','&gt;=', ((context_today()+datetime.timedelta(days=-7)).strftime('%Y-%m-%d'))), ('date_from','&lt;=', ((context_today()).strftime('%Y-%m-%d')))]"
                           help="This Week"/>


yesterday


<filter string="Yesterday"  name="Yesterday" separator="1"
                         domain="[('date_from','&gt;=', ((context_today()+datetime.timedelta(days=-1)).strftime('%Y-%m-%d'))), ('date_from','&lt;=', ((context_today()+datetime.timedelta(days=-1)).strftime('%Y-%m-%d')))]"
                           help="Yesterday"/>

Today


<filter string="Today"  name="Today" separator="1"
                         domain="[('date_from','&gt;=', ((context_today()+datetime.timedelta(days=0)).strftime('%Y-%m-%d'))), ('date_from','&lt;=', ((context_today()+datetime.timedelta(days=0)).strftime('%Y-%m-%d')))]"
                           help="Today"/>

Tomorrow



<filter string="Tomorrow"  name="Tomorrow" separator="1"
                         domain="[('date_from','&gt;=', ((context_today()+datetime.timedelta(days=1)).strftime('%Y-%m-%d'))), ('date_from','&lt;=', ((context_today()+datetime.timedelta(days=1)).strftime('%Y-%m-%d')))]"
                           help="Tomorrow"/>

Expiry



<filter string="Immediate Expiry"  name="Immediate Expiry" separator="1"
                         domain="[('date_from','&gt;=', ((context_today()+datetime.timedelta(days=0)).strftime('%Y-%m-%d'))), ('date_from','&lt;=', ((context_today()+datetime.timedelta(days=45)).strftime('%Y-%m-%d')))]"
                           help="Immediate Expiry"/>


Last Month


<filter icon="terp-go-month" string="Last Month"
                         domain="[('date_from','&lt;=', (context_today()-relativedelta(day=31, months=1)).strftime('%Y-%m-%d')),
                         ('date_from','&gt;=',(context_today()-relativedelta(day=1,months=1)).strftime('%Y-%m-%d'))]"
                         help="last month"/>

Current Month




<filter string="Current Month" name="current_month" domain="[('date_from','&lt;',(context_today()+relativedelta(months=1)).strftime('%Y-%m-01')), ('date_from','&gt;=',time.strftime('%Y-%m-01'))]"/>


Last Year

<filter  icon="terp-go-month" string="Last Year"
                domain="[('date', '&gt;=' ,(context_today()-relativedelta(years=1)).strftime('%Y-01-01')),('date','&lt;=',time.strftime('%Y-01-01'))]" help="last year"/>


This Year

<filter icon="terp-go-year" string="Year"
                            domain="[('date_from','&lt;=', time.strftime('%Y-%m-%d')),('date_from','&gt;=',time.strftime('%Y-01-01'))]"
                            help="Current Year"/>








Group By


    For adding a group by just define the field and add a filter inside the group tag.
    Eg:-am adding a group by for partner field

<?xml version="1.0"?>
<search string="Search Sales Order">
                 
                    <field name="partner_id"/>
               
                    <group expand="0" string="Group By">
                   
                           <filter string="Customer" domain="[]" context="{'group_by':'partner_id'}"/>
                 
                    </group>
 </search>





Odoo Instance Creation

Hi All,
      Am explaining the Odoo Instance Creation.

Step 1:

            ssh admin@192.168.1.148(server address)
            Log in to server

Step 2:

            sudo adduser --system --home=/opt/odoo --group odoo
            Add an User
            sudo su - odoo -s /bin/bash
            exit

Step3:

           sudo apt-get install postgresql
           install postgresql
           sudo su - postgres
           createuser --createdb --username postgres --no-createrole --no-superuser --pwprompt                    odoo
           Enter password for new role: ********(give any password)
           Enter it again:********
           exit

Step4:

         sudo apt-get install python-xlwt python-yaml wkhtmltopdf
         (Install all the python Dependencies)

Step5:

         sudo apt-get install git
         install git
         sudo su - odoo -s /bin/bash
         git clone --branch 8.0 --depth=1 https://www.github.com/odoo/odoo
         clone odoo
         exit

Step6:

         sudo cp /opt/odoo/odoo/debian/openerp-server.conf /etc/odoo-server.conf
         copy conf file 
         sudo chown odoo: /etc/odoo-server.conf
         sudo chmod 640 /etc/odoo-server.conf
         give permission to  odoo-server.conf
         sudo mkdir /var/log/odoo_log
         create a log file
         sudo chown odoo:root /var/log/odoo_log
         Give Permission to odoo user
         sudo nano /etc/odoo-server.conf
         conf file example is given







        






         sudo cp /opt/odoo/odoo/debian/init /etc/init.d/odoo-server
         sudo chmod 755 /etc/init.d/odoo-server
         sudo chown root: /etc/init.d/odoo-server
         Give permission
         sudo nano /etc/init.d/odoo-server
         service file example is given







         sudo /etc/init.d/odoo-server start
         for running instance
         less /var/log/odoo_log.log
         Refering log file
         Take a browser https://IP_or_domain.com:8069
         Default port is 8069,you can change it in conf file











Monday 27 July 2015

Sql Basic Commands

Hi All,
    Some basic SQL queries.

1.Create a Table

  Syntax:CREATE TABLE table_name
  Eg-:CREATE TABLE Employee(id integer,name varchar(10),age integer,address varchar(10),salary integer,date Date);

2.Insert values to Table

  Syntax:INSERT INTO table_name(column name1,....column name) VALUES(value1,.....value
  Eg-:INSERT INTO Employee(id, name, age, address, salary,date) VALUES( 1,'Riyas',18,'address1',1000,'1-june-1992'), ( 2,'Muhammed',19,'address2',2000,'1-june-1993')

3.Update Table

  Syntax: UPDATE table_name Set column_name=value where column_name=some_value
  Eg-:UPDATE Employee SET name='Siddharth,address='address3' WHERE name='Riyas';

4.Selecting from Table

  Syntax:Select * from table_name
  Eg-:Select * from Employee
        It will give the complete Table with data.
  Eg:-SELECT name,age FROM Employee WHERE address = 'address3';
  Eg:-SELECT name,age FROM Employee WHERE address <> 'address3';
  Eg:-SELECT name,age FROM Employee WHERE date >= '1-july-1992';
  Eg:-SELECT name,age FROM Employee WHERE (date >= '1-june-1992') AND (date <= '15-december-1993');
  Eg:-SELECT name,age FROM Employee where date BETWEEN '1-june-1992' AND '15-december-1993';
  Eg:-SELECT name,age FROM Employee WHERE date Not BETWEEN '1-june-1992' AND '15-december-1993';
  Eg:-SELECT name,age FROM Employee WHERE address = 'abc' OR address = 'address1';
  Eg:-SELECT name,age FROM Employee WHERE address IN ('abc', 'address1', 'Redmond');
  Eg:-SELECT name,age FROM Employee WHERE address NOT IN ('abc', 'address1', 'Redmond');
  Eg:-SELECT name,age FROM Employee WHERE address LIKE '_bc';(finds all three-letter address that end with 'bc')
  Eg:-SELECT name,age FROM Employee WHERE name LIKE '%as';(finds all names whose last name ends with 'as')
  Eg:-SELECT name,age FROM Employee WHERE LastName LIKE '%as%'; (finds all names whose last name includes 'as')
  Eg:-SELECT name,age FROM Employee WHERE (name NOT LIKE 'a%') AND (name NOT LIKE 'b%');
  Eg:-SELECT name,age FROM Employee ORDER BY address;
  Eg:-SELECT name,age FROM Employee ORDER BY address DESC
  Eg:-SELECT name,age FROM Employee ORDER BY address ASC, age DESC
  Eg:-SELECT name,age FROM Employee Group BY address

5.ALTER TABLE

  Syntax:-ALTER TABLE table_name ADD column_name date_type
  Eg:-ALTER TABLE Employee ADD COLUMN DateOfBirth date;
  Eg:-ALTER TABLE Employee ADD COLUMN address varchar(30);
  Eg:-ALTER TABLE Employee DROP COLUMN DateOfBirth;
  Eg:-ALTER TABLE Employee MODIFY COLUMN age varchar(30);

6.Finding and Deleting Duplicate Records

  Eg:-SELECT id, name  from Employee where name IN (SELECT name from Employee Group by       name having (count(name) >1))
  Eg:-DELETE FROM Employee WHERE name NOT IN (SELECT MIN(name) FROM Mytable         GROUP BY name)
  Eg:-delete FROM Employee WHERE id NOT IN (SELECT * FROM (SELECT MIN(n.id) FROM   Employee n GROUP BY n.name))

7.Modifying Datetime

  Eg:-select create_date + interval '4 hour' from Employee(adding 4hr with a date time object)
  Eg:-select create_date + interval '8 second' from Employee(adding 8 seconds with a date time object)
  Eg:-select create_date + interval '8 minute' from Employee(adding 8 minute with a date time object)
  Eg:-select create_date + interval '4 day' from Employee(adding 4 days with a date time object)

8.Casting

  Eg:-select CAST(create_date + interval '4 hour' AS date) as od_date from Employee(giving date as       result)
  Eg:-select CAST(age AS float) from Employee;

9.Extracting

  Eg:-select EXTRACT(month FROM date_order) as VARCHAR(50) from Employee;
  Eg:-select EXTRACT(year FROM date_order) as VARCHAR(50) from Employee;

10.Case Statement

  Eg:-CASE WHEN address='abc' THEN 'Correct' ELSE 'wrong' END AS type from Employee;
  Eg:-CASE WHEN (code = 'BASIC') THEN amount ELSE 0 END AS BASIC;

11.Sum function

  Eg:-sum(age) AS total Age AS from Employee
  Eg:-CASE WHEN sum(age)<>0 THEN ((sum(age)+sum(age))/sum(age))*100*-1 ELSE 0 END AS   markup
  Eg:-select CASE WHEN hr_payslip.xo_total_no_of_days > 0 THEN              (hr_contract.xo_total_wage/hr_payslip.xo_total_no_of_days)
  ELSE(hr_contract.xo_total_wage/1) END AS daily_salary from Employee;

12.Concatenation

   Eg:-select CONCAT(CAST(EXTRACT(month FROM date_order) as                                              VARCHAR(50)),'/',CAST(EXTRACT(year FROM date_order)
 as VARCHAR(50))) from Employee;

13.Max function

   Eg:-select max(date) from employee;
   Eg:-select max(age) from employee;

14.to_char

   Eg:-to_char(date_from,'yyyy/mm') as period from Employee,

15.AVG

   Eg:-SELECT AVG(VacationHours)AS 'Average vacation hours',SUM(SickLeaveHours) AS 'Total    sick leave hours' FROM Employee
   WHERE JobTitle LIKE 'Vice President%';

16.CHECKSUM_AGG

   Eg:-SELECT CHECKSUM_AGG(CAST(Quantity AS int)) FROM Employee;

17.Count

   Eg:-SELECT COUNT(name) FROM Employee;

18.Grouping

   Eg:-SELECT SalesQuota, SUM(SalesYTD) 'TotalSalesYTD', GROUPING(SalesQuota) AS      'Grouping' FROM Employee GROUP BY SalesQuota WITH ROLLUP;

19.MIN

   Eg:-SELECT MIN(TaxRate) FROM employee;

20.Delete Command

  Syntax:-Delete from table_name;
  Eg:-DELETE from Employee;


21.Drop Command

  Syntax:-DROP TABLE table_name;
  Eg:-DROP TABLE Employee;

22.For avoiding division by zero


Eg:-(sum((l.qty * l.price_unit)) / NULLIF(sum((l.qty * u.factor)),0))

23.For null value replace in to zero

Eg:-COALESCE(l.cost_price, (0)::numeric)




                                     Joining Tables

a)Table:CUSTOMERS


b)Table:ORDERS










Now, let us join these two tables in our SELECT statement as follows:

SELECT ID, NAME, AGE, AMOUNT FROM CUSTOMERS, ORDERS
WHERE  CUSTOMERS.ID = ORDERS.CUSTOMER_ID;

This would produce the following result:










1.Left Joining


The SQL LEFT JOIN returns all rows from the left table, even if there are no matches in the right table. This means that if the ON clause matches 0 (zero) records in right table, the join will still return a row in the result, but with NULL in each column from right table.

This means that a left join returns all the values from the left table, plus matched values from the right table or NULL in case of no matching join predicate.
Syntax:

The basic syntax of LEFT JOIN is as follows:

SELECT table1.column1, table2.column2...
FROM table1
LEFT JOIN table2
ON table1.common_field = table2.common_field;
Now, let us join these two tables using LEFT JOIN as follows:

SELECT  ID, NAME, AMOUNT, DATE FROM CUSTOMERS
LEFT JOIN ORDERS
ON CUSTOMERS.ID = ORDERS.CUSTOMER_ID;















2.Inner Joining


The INNER JOIN creates a new result table by combining column values of two tables (table1 and table2) based upon the join-predicate. The query compares each row of table 1 with each row of table2 to find all pairs of rows which satisfy the join-predicate. When the join-predicate is satisfied, column values for each matched pair of rows of A and B are combined into a result row.
Syntax:

The basic syntax of INNER JOIN is as follows:

SELECT table1.column1, table2.column2...
FROM table1
INNER JOIN table2
ON table1.common_field = table2.common_field;

Example:
Now, let us join these two tables using INNER JOIN as follows:

SELECT  ID, NAME, AMOUNT, DATE FROM CUSTOMERS
INNER JOIN ORDERS
ON CUSTOMERS.ID = ORDERS.CUSTOMER_ID;
















3.Right Joining


The SQL RIGHT JOIN returns all rows from the right table, even if there are no matches in the left table. This means that if the ON clause matches 0 (zero) records in left table, the join will still return a row in the result, but with NULL in each column from left table.

This means that a right join returns all the values from the right table, plus matched values from the left table or NULL in case of no matching join predicate.
Syntax:

The basic syntax of RIGHT JOIN is as follows:

SELECT table1.column1, table2.column2...
FROM table1
RIGHT JOIN table2
ON table1.common_field = table2.common_field;


Now, let us join these two tables using RIGHT JOIN as follows:

SELECT  ID, NAME, AMOUNT, DATE FROM CUSTOMERS
RIGHT JOIN ORDERS
ON CUSTOMERS.ID = ORDERS.CUSTOMER_ID;

This would produce the following result:

















4.Full Joining


The SQL FULL JOIN combines the results of both left and right outer joins.
The joined table will contain all records from both tables, and fill in NULLs for missing matches on either side.
Syntax:

The basic syntax of FULL JOIN is as follows:

SELECT table1.column1, table2.column2...
FROM table1
FULL JOIN table2
ON table1.common_field = table2.common_field;

Now, let us join these two tables using FULL JOIN as follows:

 SELECT  ID, NAME, AMOUNT, DATE  FROM CUSTOMERS
 FULL JOIN ORDERS
 ON CUSTOMERS.ID = ORDERS.CUSTOMER_ID;

This would produce the following result:























5.Self Joining


The SQL SELF JOIN is used to join a table to itself as if the table were two tables, temporarily renaming at least one table in the SQL statement.
Syntax:

The basic syntax of SELF JOIN is as follows:

SELECT a.column_name, b.column_name...
FROM table1 a, table1 b
WHERE a.common_field = b.common_field;


Now, let us join this table using SELF JOIN as follows:

SELECT  a.ID, b.NAME, a.SALARY FROM CUSTOMERS a, CUSTOMERS b
WHERE a.SALARY < b.SALARY;

This would produce the following result:






































6.Cartesian Product


The CARTESIAN JOIN or CROSS JOIN returns the Cartesian product of the sets of records from the two or more joined tables. Thus, it equates to an inner join where the join-condition always evaluates to True or where the join-condition is absent from the statement.
Syntax:

The basic syntax of CARTESIAN JOIN is as follows:

SELECT table1.column1, table2.column2...
FROM  table1, table2 [, table3 ]

Now, let us join these two tables using CARTESIAN JOIN as follows:

SELECT  ID, NAME, AMOUNT, DATE
FROM CUSTOMERS, ORDERS;

This would produce the following result:






Wednesday 22 July 2015

Odoo Out Going Mail Server Configuration

Hi All,

     I will explain how to configure an outgoing mail server in Odoo.
     First go to Settings > Email > Outgoing Mail servers and click on Create.
     You will get a new window looking like this:



    Lets Fill the Fields,

  1. Description: Description about the mail server to be configured.
  2. SMTP Server: Hostname or IP of SMTP server   Eg-:smtp.gmail.com.
  3. SMTP Port:465(Secure Port).
  4. Connection Security: Select SSL/TLS from the drop down list.
  5. Username: Username: for SMTP authentication Eg-:riyasshon@gmail.com
  6. Password:Its for SMTP authentication Eg-: Password for riyasshon@gmail.com.

   After click Test Connection Button.

   Save the Form you are done it.