Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

phpmailer, php, header, email goes to spam

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: [email protected]
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: <[email protected]>
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 [email protected] 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 [email protected] designates 208.78.241.38 as permitted sender) [email protected]
Received: by xpal.com (Postfix, from userid 33)
id F31C12C30BA; Mon,  9 May 2011 17:05:29 -0700 (PDT)
To: Ajith Ravi <[email protected]>
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 <[email protected]>
Reply-to: Xpal Members Alert <[email protected]>
Message-ID: <[email protected]>
X-Priority: 3
X-Mailer: PHPMailer 5.1 (phpmailer.sourceforge.net)
MIME-Version: 1.0
Content-Type: multipart/alternative;
boundary="b1_e773974b10a1d7a0e54d55f489427da1"
like image 320
sniper Avatar asked May 10 '11 00:05

sniper


1 Answers

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.

like image 51
kevinji Avatar answered Oct 04 '22 04:10

kevinji