I remember the first time I created a server based email in PHP. It was my first start-up and I wanted to make sure that people that used my app stayed connected. Things have changed since PHP3 and security has become much more important in the fight against SPAM. If you find that your emails are getting bounced to the SPAM folders try the basics of using and email deployment service like Mandrill or even making sure your email headers are valid. Once you’re past that, try to ensure your emails are signed with either SPF or DKIM keys, Google+ and Gmail features rely on these. Here is a great overview that I dug up :

https://mandrill.zendesk.com/hc/en-us/articles/205582267-About-SPF-and-DKIM#authentication

Need help setting these up or improving your email delivery, I’m always here to help.