Firstly I am using XAMPP.
This issue fixes error codes:
Start by opening your php.ini file and editing the following:
Must issue a STARTTLS command first
530 5.7.0 Must issue a STARTTLS command first."
SMTP server error: 5.5.1 Authentication Required. Learn more at 530 5.5.1
Now download the latest Sendmail and go to C:\xampp\sendmail and replace the sendmail.exe and sendmail.ini with the files extracted. Now open the sendmail.ini and replace everything in there with this.
SMTP = smtp.gmail.com
smtp_port = 25
sendmail_from = email@example.com
sendmail_path = "C:\xampp\sendmail\sendmail.exe -t"
Now the password was the part I was getting issues with, I tried most peoples recommendations by Allowing less secure apps with gmail, but this seems to have disappeared as of July 2017. What you need to do is authorise an app, select device as Windows and then generate password copy this into the auth_password in sendmail.ini. Try it again and it should work fine now.
To help you along you can always look in the debug.log file in C:\xampp\sendmail.