Originally Posted by LearningCoder
Sorry to jump in, but how do some sites manage to get them straight to your inbox if it's client functionality?
Usually you send the emails through an SMTP account on your domain, which fixes most issues. You can also send through a trusted third-party such as SendGrid, Postmark, etc. that use best practices, SPF records, and DKIM to help prevent your messages from being flagged as spam. Of course, if you truly are sending spam you will probably still get flagged. But, the first and easiest step is to simply start sending your email through SMTP.
OP's primary issue is likely that they are trying to send from/reply-to headers that point to different domains. That will often get your emails flagged as spam in my experience.