Have you ever looked at something from so many angles you think you’re going to go crazy? The email functionality of the sprinkler program was not working and after the umpteenth idea of what it might be, I finally came across something that triggered the answer. I knew I was failing to send due to a 401 error which is an authorization problem, but couldn’t understand why it worked from my browser and not from the photon. Well, it turns out I had put the script in a folder that I had password protected (where the garage door web pages reside), and in chrome once you log in with one tab, they are all logged in. So, I was logging in implicitly while in chrome and the request and email worked. The solution, make sure and put any scripts (php) you are using for external access from the photon in an open area of your web host, so that the photon can access it. There is probably a way to get it to login, but for the most part these scripts will be hidden on the photon and not used by anything exposed too much.
Hope this helps you avoid the problem.
Have fun coding.