I'm subscribed to a webhosting service. I have a PHP form set up that accepts requests (from mobile phones, actually); these requests include a to: and from: address. When it receives a request with these two variables, it accesses a MySQL db and then sends an email to the to: address, on behalf of the from: address.

That all works fine. I set up logging, and in several days of logs, haven't seen a single error. So everything is making into the mail queue just fine. But sometimes messages don't go through; they seem to get lost somewhere and never make it to the recipient.

The only thing I can think of is that messages are getting marked as spam by the recipients' provider?

The messages are getting sent with a different From: address in the header that has nothing to do with my server. Also, sometimes the messages will have an empty subject line. Would filling in the subject line and leaving out the From: address help reduce my "spam" rating?

Is there anything I can do to make sure the messages don't get stopped by spam filters?

Any other possibilities as to why the emails aren't making it to their destination?