If you got error while sending email by using gmail (as sender ) at live server.
error message” Username and Password not accepted. Lea$
535 5.7.8 https://support.google.com/mail/?p=BadCredentials w187sm24324471pfw.62 – gsmtp”
Go to this link and disable unlock Captcha
This is simply because Google blocked unsecure login to SMTP by default because for security