I did something like this to make my web app sends mails through gmail's SMTP. I tried locally and it worked. after I upload to the server (which is in another country) I get this error:
authentication failure [SMTP: Invalid response code received from server (code: 534, response: 5.7.9 Please log in with your web browser and then try again. Learn more at 5.7.9 https://support.google.com/mail/bin/answer.py?answer=78754 5.7.9 {WEBLOGINREQUIRED} fl2sm1579003pab.23 - gsmtp)]
is there a way to ignore this?