The users on my site contact each other by e-mail using an e-mail form.
The mails are being sent with thee user email as sender!
How do I prevent the mails from ending up in the spam folder?
Especially hotmail likes to throw the mail sent in the spam folder.
My host has features like "Reverse DNS" and "SPF Protection", which I have read a bit about.
But are they applicable when I am sending e-mails with the users e-mail as sender?
The simple way to fix it is don't do that!
Unfortunately the real solution to improving email deliverability is much more involved.
SPF is "Sender Policy Framework" which basically allows an email host to explicitly specify which servers are authorized to send email from an address at the given domain. This is becoming increasingly common due to from address spoofing by spam and phishing attacks. If you are attempting to send from a user's email address with an SPF your best case these days is email in the spam with a more likely result being a big warning on the (spam flagged) email or getting silently dropped altogether.
rDNS is generally used to show a valid relationship between the ip and the domain of the email sender. (if you are sending from a user then you don't have a valid relationship.)
Both of these things will indicate that your emails are not trustworthy because you are claiming to be sending from a particular domain when you aren't.
Don't send "from" those users, use the on-behalf-of
header and/or the reply-to
header.
That alone won't keep you out of the spam folder though. Beyond using email headers correctly, What you need to do to ensure deliverability is the following:
Send from an address in your domain. Typically this is a non-monitored account either configured to drop all incoming messages or parse them for bounces and update your system accordingly.
Configure SPF, DKIM and possibly Domainkeys on your email. This will increase the likelihood that your email won't be flagged as spam.
Be CAN-SPAM compliant. This will both improve your spam score, and by making it easy for people to opt-out, you get less "report as spam flags" which will help keep you from getting blacklisted.
Monitor your IP address in spam blacklists as it will happen anyway. Work with individual providers to get removed. One popular place to monitor your blacklist status is mxtoolbox.com
Be patient. Many big email hosting companies are very aggressive about spam. Often they employ a "guilt until proven innocent" approach meaning people have to take your email out of spam an unspecified number of times before you go from 'greylisted' to 'whitelisted.' Some hosts have a procedure you can follow to get whitelisted but often it's a case by case basis.
The alternative is to use a relay service that manages 1-5 for you, but at a cost. Personally I have a dedicated IP solution with sendgrid.com because managing email these days is a real hassle. I have no relationship with sendgrid other than being a customer.
You should not be attempting to send e-mails with the from address as your users' e-mail address.
All this accomplishes is to make your e-mail look like spam.
There is no way to "fix" this problem. It's simply how spam heuristics work (and for good reason).
If you're sending mail from your site with the sender reported as the user's real e-mail address, then you're forging the mail sender and that is likely what is making mail providers treat the mail as spam. Can't fix it, just don't do that.
Try setting user's email as the the Reply-To
address instead of as the To
address. Some mail clients will show the email as coming from the Reply-To
- others will show the original To
address. That's about the best you can do to get the desired behavior.