6

I am running into a problem while sending out emails from the system and the problem is that the email gets delivered to the spam box in gmail/yahoo/hotmail. I am posting here, after doing my bit of homework, and have already validated and checked the SPF settings, Reverse DNS settings(was pointing elsewhere, and made the change this morning about 5 hours ago). The RDNS check now says the mapping is perfect. Yet no luck. Mails are going to spambox. What could be the problem?

Background : I use PHP with PHPMailer to send out emails.

The header from the mail received in the spam box :

Delivered-To: ajithsubramanian@gmail.com
Received: by 10.227.144.12 with SMTP id x12cs63931wbu;
    Mon, 9 May 2011 17:05:44 -0700 (PDT)
Received: by 10.68.64.225 with SMTP id r1mr11349194pbs.250.1304985942785;
    Mon, 09 May 2011 17:05:42 -0700 (PDT)
Return-Path: <info@xpal.com>
Received: from xpal.com (208.78.241.38.svwh.net [208.78.241.38])
    by mx.google.com with ESMTPS id w1si21200467pbh.199.2011.05.09.17.05.40
    (version=TLSv1/SSLv3 cipher=OTHER);
    Mon, 09 May 2011 17:05:41 -0700 (PDT)
Received-SPF: pass (google.com: domain of info@xpal.com designates 208.78.241.38 as permitted sender) client-ip=208.78.241.38;
Authentication-Results: mx.google.com; spf=pass (google.com: domain of info@xpal.com designates 208.78.241.38 as permitted sender) smtp.mail=info@xpal.com
Received: by xpal.com (Postfix, from userid 33)
id F31C12C30BA; Mon,  9 May 2011 17:05:29 -0700 (PDT)
To: Ajith Ravi <ajithsubramanian@gmail.com>
Subject: checkarun replied on your xpalling on Sindura
X-PHP-Originating-Script: 0:phpmailer_class.php
Date: Mon, 9 May 2011 17:05:29 -0700
From: XPal Members Alert <info@xpal.com>
Reply-to: Xpal Members Alert <info@xpal.com>
Message-ID: <e773974b10a1d7a0e54d55f489427da1@xpal.com>
X-Priority: 3
X-Mailer: PHPMailer 5.1 (phpmailer.sourceforge.net)
MIME-Version: 1.0
Content-Type: multipart/alternative;
boundary="b1_e773974b10a1d7a0e54d55f489427da1"
sniper
  • 2,905
  • 6
  • 21
  • 27

2 Answers2

2

This is because when you send a mail with the PHP mail() function, if you are using a shared host, it will appear in your Received header. One way is to change your headers that you are sending. This article and this article give a good way to bypass spam filters by changing headers.

For best practices, you should investigate using the Sender Policy Framework (SPF) to avoid being regarded as spam.

You might also be interested in sendmail, which connects to another email account (say, a Gmail account) and sends mail from that account, not from your local server.

Kevin Ji
  • 10,479
  • 4
  • 40
  • 63
  • @mc10, Thanks!! Since I am using phpmailer to send, I sure am changing my headers. I did go through those articles and looks like I am doing most of it right. The server I am using is a dedicated server, so that may not be a problem. Updated header details : Received: from xpal.com (xpal.com [208.78.241.38]) by mx.google.com with ESMTPS id k2si21395354pbo.204.2011.05.09.18.38.54 (version=TLSv1/SSLv3 cipher=OTHER); What could the potential issue be? – sniper May 10 '11 at 01:47
  • Here is the snippet of the code I am setting inside the class function that sends out the emails : `$mail = new phpmailer(); $mail->AddCustomHeader('Reply-to:info@xpal.com'); $mail->From="info@xpal.com"; $mail->FromName="XPal Members Alert";` – sniper May 10 '11 at 01:51
  • Are you sending the mail from the XPal server? If not, then you may have issues with [DKIM](http://en.wikipedia.org/wiki/DomainKeys_Identified_Mail). You need to send a DKIM header as well for confirmation by mail agents. – Kevin Ji May 10 '11 at 01:55
  • Ahh, you have exactly touched my grey area. :) . Let me get my questions clarified. If I am using the sendmail available on the xpal server to send out the email(phpmailer class does this), does that necessarily mean that I am sending the mail out from the xpal server? If not, what happens after the sendmail program is activated? My domain key manager told me told me once that he has not added the mailserver IP of the hosting company to the TXT file. Could that be a reason? Thanks again! :) – sniper May 10 '11 at 02:03
  • Another issue: Your header contains `208.78.241.38.svwh.net [208.78.241.38]`, which contains your host's name. – Kevin Ji May 10 '11 at 02:05
  • So am I correct when you say that you actually send out the mail on the XPal server? – Kevin Ji May 10 '11 at 02:06
  • Oh I had updated the latest header in the first comment. Here it goes again : `Received: from xpal.com (xpal.com [208.78.241.38]) by mx.google.com with ESMTPS id k2si21395354pbo.204.2011.05.09.18.38.54 (version=TLSv1/SSLv3 cipher=OTHER);` The original Received: posted might have had svwh.net info because the RDNS settings could have been propagating still this afternoon :) – sniper May 10 '11 at 02:08
  • I guess I am sending the mails out on the XPal server(the phpmailer class, uses the default sendmail program on the server to send the email out)... – sniper May 10 '11 at 04:17
0

Try a search or check related. Most notably, most all is answered here.

Mel
  • 6,077
  • 1
  • 15
  • 12
  • Thanks Mel! I did go through that before I posted my question here. Looks like a header related issue, but I am just hoping that someone can see through something thats wrong in the header that I've shared! :) – sniper May 10 '11 at 01:52
  • I would say before reading that, ensure that all the headers for the mail are sent, then if you still can't get it start with that link. I have found most of my troubles have always been from things like bad header info, links in the title, or other little things like that. – Kenny Cason Feb 16 '12 at 10:13