Php mail: legitimate emails marked as gmail and hotmail spam

My site sends emails to users using the PHP mail feature. Hotmail and Gmail users do not receive them, or they end up in the SPAM folder. Here is the header of the message marked as Gmail SPAM.

What to do?

Delivered-To: koopter1982@gmail.com Received: by 10.216.213.222 with SMTP id a72cs207473wep; Sat, 2 Oct 2010 04:26:47 -0700 (PDT) Received: by 10.216.3.19 with SMTP id 19mr3099233weg.108.1286018806068; Sat, 02 Oct 2010 04:26:46 -0700 (PDT) Return-Path: < admin@drt01.dco.fusa.be > Received: from drt01.dco.fusa.be (drt01.dco.fusa.be [193.110.251.55]) by mx.google.com with ESMTP id m29si2837219weq.203.2010.10.02.04.26.45; Sat, 02 Oct 2010 04:26:46 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of admin@drt01.dco.fusa.be designates 193.110.251.55 as permitted sender) client-ip=193.110.251.55; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of admin@drt01.dco.fusa.be designates 193.110.251.55 as permitted sender) smtp.mail=admin@drt01.dco.fusa.be Received: from admin by drt01.dco.fusa.be with local (Exim 4.69) (envelope-from < admin@drt01.dco.fusa.be >) id 1P20En-000303-Lo for koopter1982@gmail.com ; Sat, 02 Oct 2010 13:26:45 +0200 To: koopter1982@gmail.com Subject: Koopte: zoekertje activeren X-PHP-Script: www.koopte.be/confirmation.php for 213.118.179.121 From: Koopte < zoekertjes@koopte.be > Reply-To:< zoekertjes@koopte.be > Content-Type: text/html; charset=iso-8859-1 Message-Id: < E1P20En-000303-Lo@drt01.dco.fusa.be > Sender: < admin@drt01.dco.fusa.be > Date: Sat, 02 Oct 2010 13:26:45 +0200 
+6
php email gmail spam
source share
2 answers

Your envelope does not match the address. This is the main reason why emails are considered spam.

Background: the address of the envelope (in your case admin@drt01.dco.fusa.be ) is not actually displayed to the user. It is simply used by mail servers to return error messages. Historically, this is because they are more relevant to the administrator than to the user. However, today its de facto standard sets the envelope address to the same as the user's address. Spammers do not actually do this because they either do not have the ability or they do not want to receive all error messages when sending spam. Or they don’t want exploited users with a Trojan worm to know about their atrocities.

In php / sendmail, this function is called the f parameter. You can read all about this in the function documentation: http://php.net/manual/en/function.mail.php

Classes like phpmailer or libmail do it themselves, and probably the best idea is to use one of them, because they have been tested, well designed and responsive to changes in their development!

The next thing you could do is set the reverse DNS in the same domain as the sender address. If you do this, you really deserve trust, because mail can be mapped to a server and, therefore, to a provider / administrator, and can be easily blacklisted in spam networks. Therefore, if you are spamming with correctly configured reverse DNS, you would not do this for long. There is a built-in directive in arpa rulse that setting up such a record takes some time, so it cannot be exploited in any way.

This, however, is pretty advanced, and there can only be one reverse dns entry per ip address. Therefore, you cannot do this in a shared hosting environment. You must also contact your provider to configure them, but you can use Google for all of this.

Amount:

  • correct the envelope address, it should be fine
  • if you can, set the reverse dns record

PS: in fact, there are no rules on how and when to consider mail as spam, and the above technologies have proved their effectiveness only in practice, but there is absolutely no guarantee. Each mail provider can do what he wants ... (yahoo was one of those candidates who did their own thing and annoyed everyone all the time)

luck

+5
source share

Try using Google applications and configure the spf entry, go to settings β†’ security and configure the txt dkim key. Then configure the mx entries, etc. Do it all on the subdomain of your domain (for example, int.domain.com), and then use smtp to send mail from phpmail after logging in to your Google account, by clicking the settings button on the right mouse button, settings, php / imap and enabling both .

This always works for me and they never get marked as spam because they come from google servers and have the correct header, return path, sender, smtp, spf record, txt dkim record, mx records, etc.

Try this and let me know if this works :)

+1
source share

All Articles