If you are trying to send mail using gmail SMTP, first you need to disable security. You can find this option in your gmail setting or when you send mail, you will get one mail from gmail which will help you to disable security.