First you need to configure the php.ini
and sendmail.ini
files correctly.
The sendmail.ini
file should contain
first smtp_server=mail.gmail.com ,
second smtp_port=465 (if not worked try 587),
third auth_username= xxx@gmail.com auth_password=yourpassword
after this restart your server.