If you want to read email form script you need to allow less secure app as same as Gmail, 

Just Go to the link, after login and allow less secure app at the bottom.

https://login.yahoo.com/account/security

Go to "Generate app password"

yahoo mail

Select appropiate option and hit generate.

and you are good to go, this was new settings by yahoo for third party apps.