@Mindy: Welcome to PHPBuilder! When posting PHP code, please use the board's [noparse]
..
[/noparse] bbcode tags as they make your code much easier to read and analyze.
As for your issue, it's possible that spam filters are marking your generated e-mails as spam simply because they don't look like legitimate messages. To avoid this, you could try adding more headers (e.g. Sender, MIME-Version, Content-Type, Content-Transfer-Encoding, etc.).
Another issue may be that your e-mail server has been listed on one or more blacklists or RBLs. There are some free online tools (such as this one) that will allow you to search many databases to check this, but note you'd need to know the IP address of your outgoing mail server (which is not necessarily the same as your web server).
@: No offense meant, but I just wanted to clear up a bit of confusion from your last reply...
dalecosp;10996344 wrote:In particular, try and make sure that your FROM address exists
Having a valid (or invalid, in terms of whether your mailserver has a valid mailbox associated with the address) 'From' address will neither help nor harm your chances of the message being treated as spam. There's one simple reason why you can be sure of this: it is impossible to determine whether you can actually deliver mail to a given e-mail address.
Now, that's not to say that you shouldn't make the message look as if it originated from somewhere on the domain from which it is being sent; failing to do that will definitely make most spam filters reject the message. However, note that the 'From' header really isn't what most (RFC-compliant) spam filters will be interested in; it's really the 'Sender' header that makes claims as to where the message is actually being sent from. It just so happens that they should also assume the 'Sender' is the same as the 'From' address if you don't explicitly specify the former.
dalecosp;10996344 wrote:and possibly even is the same as the REPLY-TO address.
That definitely won't help; the whole point of the Reply-To header even existing or being used is to state that the originating e-mail address is not to be used as the destinations of replies.
If the addresses were the same, then there'd be no point in using the 'Reply-To' header at all.
dalecosp;10996344 wrote:Also, there may be a message header added by your VPS server that indicates PHP was sending the message.
Not likely, because the MTA shouldn't know that PHP was even sending the message. There's no handshaking process where an MTA will identify which application/process is attempting to use it in order to deliver mail.
Now, what is possible, however, is that PHP is voluntarily identifying itself in the form of an "X-" header (which aren't usually considered in terms of scoring the message in terms of spaminess), e.g. via mail.add_x_header or even an 'X-Mailer:' header that many applications commonly include in PHP-generated messages.