I need to send some automated emails from a program I'm working on. This is a new feature. I'm generating the emails, but they get filtered by most of the email servers that I send tests to. Only one server I am using accepts the emails and it allows a lot of spam through. I need to find what headers or authentication or whatever I need to add to make the emails acceptable to major servers.
I've tried searching the internet for questions about sending automated emails, but the lead responses are all from companies that are willing to send the emails for me, or that are recommending what the body should look like.
How do I authenticate the email so that it doesn't get flagged or filtered as spam?