mail() keeps sending to spam boxes
Moderator: General Moderators
mail() keeps sending to spam boxes
Hi all,
Sorry for this post but I'm at my wit's end with this one, not sure where to start debugging or what info to give.
I've never had so much problem with the mail() function sending to spam boxes, I'm sure it's some aspect of how the hosting company sets things up, something to do with domains of this that or the other. That's as far as I'm willing to guess!
If anyone can help me debug this issue, please please just ask for whatever information would be helpful and I'll get right on it. (phpinfo() etc, or whatever!)
Thankyou thankyou thankyou!!!
Sorry for this post but I'm at my wit's end with this one, not sure where to start debugging or what info to give.
I've never had so much problem with the mail() function sending to spam boxes, I'm sure it's some aspect of how the hosting company sets things up, something to do with domains of this that or the other. That's as far as I'm willing to guess!
If anyone can help me debug this issue, please please just ask for whatever information would be helpful and I'll get right on it. (phpinfo() etc, or whatever!)
Thankyou thankyou thankyou!!!
Spam lists don't care about you using a big company, small company, your own server, whatever. If the IP block is found sending spam they'll close it off. What that means is that if someone else using the same company is sending spam then you might find your emails being blocked because a particular list has blocked the entire host. It's very annoying.foobaa wrote:It's got to be headers cos I'm using a big UK hosting company which is just a subsidiary.
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
I'm going to write a long in-depth article about minimizing the impact of spam checkers and where to look for help/tools. It'll appear in the Swift wiki, until then I can summarise:
If you're using mail() only rudimentary headers will be used by default - these vary from server-to-server too! - Compose your own headers - keep them down to 78 chars (including \r\n) in length of you can -- 1000 chars max!
Don't put UTF-8 characters in the headers.... if you need to do that, use Swift mailer.
Make sure email addresses in the headers actually exist!
If you're sending HTML, make sure you also send a plain-text part with the same content.
Try not to send extremely short messages
Check if any hosts your message goes through are blacklisted
If it's withing your control (DNS level) make sure you have a SPF record
Obviously, anybody trying to send junk and still by-pass the filters won't get much useful advice on "cheating" the checks
If you're using mail() only rudimentary headers will be used by default - these vary from server-to-server too! - Compose your own headers - keep them down to 78 chars (including \r\n) in length of you can -- 1000 chars max!
Don't put UTF-8 characters in the headers.... if you need to do that, use Swift mailer.
Make sure email addresses in the headers actually exist!
If you're sending HTML, make sure you also send a plain-text part with the same content.
Try not to send extremely short messages
Check if any hosts your message goes through are blacklisted
If it's withing your control (DNS level) make sure you have a SPF record
Obviously, anybody trying to send junk and still by-pass the filters won't get much useful advice on "cheating" the checks
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
Sometimes entire submasks can be blocked... sad. NEVER rely on a shared host for sending email... they are blacklisted so regularly it's just not reliable. You can also end up on a blacklist yourself by being careless and having your SMTP set up as an open relay or not having an SPF record to verify that you're the one sending the email, not some spammer.onion2k wrote:Spam lists don't care about you using a big company, small company, your own server, whatever. If the IP block is found sending spam they'll close it off. What that means is that if someone else using the same company is sending spam then you might find your emails being blocked because a particular list has blocked the entire host. It's very annoying.foobaa wrote:It's got to be headers cos I'm using a big UK hosting company which is just a subsidiary.
feyd | Please use
And the headers I get when I do "view original" in gmail are:
Thanks again
Jody
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Right...thanks for the help, really appreciate the support. Sadly,
0) it's still going to the spam box...
1) The host isn't (doesn't seem to be) black listed
2) It's plain text, no special characters anywhere (I think)
3) The email addresses in the header do (seem to) exist
4) All the headers are shorter than 78 chars
5) I tried swift (sendmail connection) and I don't even get an email in the spam box. $mailer->send returns false, not sure what this means.
The code I've been trying is:Code: Select all
$domain = $_SERVER['SERVER_NAME']; //(desperation)
echo "SENDING";
echo mail(
$to,
$subject,
$body,
"From: noreply@$domain"
);And the headers I get when I do "view original" in gmail are:
Code: Select all
Delivered-To: jody.florian@gmail.com
Received: by 10.48.220.19 with SMTP id s19cs344522nfg;
Wed, 14 Feb 2007 09:52:12 -0800 (PST)
Received: by 10.48.246.4 with SMTP id t4mr462932nfh.1171475532764;
Wed, 14 Feb 2007 09:52:12 -0800 (PST)
Return-Path: <aplanning@rubidium.webfusion.co.uk>
Received: from rubidium.webfusion.co.uk (rubidium.webfusion.co.uk [212.67.202.84])
by mx.google.com with ESMTP id n23si2440301nfc.2007.02.14.09.52.12;
Wed, 14 Feb 2007 09:52:12 -0800 (PST)
Received-SPF: pass (google.com: best guess record for domain of aplanning@rubidium.webfusion.co.uk designates 212.67.202.84 as permitted sender)
Received: from aplanning by rubidium.webfusion.co.uk with local (Exim 4.54)
id 1HHOIb-0005mn-1A; Wed, 14 Feb 2007 17:52:09 +0000
To: vicki.wombwell@gmail.com, jody.florian@gmail.com
Subject: Join Mailing List Request
From: noreply@actionplanning.co.uk
Message-Id: <E1HHOIb-0005mn-1A@rubidium.webfusion.co.uk>
Date: Wed, 14 Feb 2007 17:52:09 +0000
This is an automated message, please do not reply.
===Name===
Jody
===Job Title===
===Organisation===
===Type of organisation===
===Address===
===Phone===
===Email===
vicki.wombwell@gmail.com
===Income===
Sent: 05:52:08PM 14th Feb 2007Thanks again
Jody
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
It means either sendmail is rejecting it, is misconfigured, or even not installed. Do you know the path to sendmail?foobaa wrote:I tried swift (sendmail connection) and I don't even get an email in the spam box. $mailer->send returns false, not sure what this means.
That's not compliant.... this is why you shouldn't really use mail() unless you know exactly how emails should be structuredThe code I've been trying is:
$domain = $_SERVER['SERVER_NAME']; //(desperation)
echo "SENDING";
echo mail(
$to,
$subject,
$body,
"From: noreply@$domain"
);
No Content-Type, no Content-Transfer-Encoding, no charset.And the headers I get when I do "view original" in gmail are:
Delivered-To: jody.florian@gmail.com
Received: by 10.48.220.19 with SMTP id s19cs344522nfg;
Wed, 14 Feb 2007 09:52:12 -0800 (PST)
Received: by 10.48.246.4 with SMTP id t4mr462932nfh.1171475532764;
Wed, 14 Feb 2007 09:52:12 -0800 (PST)
Return-Path: <aplanning@rubidium.webfusion.co.uk>
Received: from rubidium.webfusion.co.uk (rubidium.webfusion.co.uk [212.67.202.84])
by mx.google.com with ESMTP id n23si2440301nfc.2007.02.14.09.52.12;
Wed, 14 Feb 2007 09:52:12 -0800 (PST)
Received-SPF: pass (google.com: best guess record for domain of aplanning@rubidium.webfusion.co.uk designates 212.67.202.84 as permitted sender)
Received: from aplanning by rubidium.webfusion.co.uk with local (Exim 4.54)
id 1HHOIb-0005mn-1A; Wed, 14 Feb 2007 17:52:09 +0000
To: vicki.wombwell@gmail.com, jody.florian@gmail.com
Subject: Join Mailing List Request
From: noreply@actionplanning.co.uk
Message-Id: <E1HHOIb-0005mn-1A@rubidium.webfusion.co.uk>
Date: Wed, 14 Feb 2007 17:52:09 +0000
This is an automated message, please do not reply.
===Name===
Jody
===Job Title===
===Organisation===
===Type of organisation===
===Address===
===Phone===
===Email===
vicki.wombwell@gmail.com
===Income===
Sent: 05:52:08PM 14th Feb 2007
Also, the Return-Path (bounce-detect address and MAIL FROM envelope) doesn't exist... or if it does, it's not reachable since I can't find an MX record for it:
Code: Select all
w3style:~/public_html/swiftmailer2 d11wtq$ dig MX rubidium.webfusion.co.uk
; <<>> DiG 9.3.2 <<>> MX rubidium.webfusion.co.uk
;; global options: printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 43150
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0
;; QUESTION SECTION:
;rubidium.webfusion.co.uk. IN MX <------- BAD BAD BAD!!!!!
;; AUTHORITY SECTION:
webfusion.co.uk. 300 IN SOA ns.webfusion.co.uk. hostmaster.webfusion.co.uk. 2006092601 3600 1800 1209600 86400
;; Query time: 23 msec
;; SERVER: 194.168.4.100#53(194.168.4.100)
;; WHEN: Wed Feb 14 18:33:49 2007
;; MSG SIZE rcvd: 92Thanks for the help! That's some amazing feedback, wish I could post a bottle of wine or something lol!
The hosting company finally confessed and said in fact, they're losing a lot of money and at the director level they're running around trying to get themselves off a spam list, so in fact it would seem this is at least potentially one of the problems, (which spam list they're on is obviously a mystery to all concerned lol) but this forum topic I've bookmarked will be a page I study relentlessly until I get the hang of it lol!! (and sorry for the poor formatting of the code!!)
Thanks d11wtq, onion2k, feyd!
All the best
Jodes
The hosting company finally confessed and said in fact, they're losing a lot of money and at the director level they're running around trying to get themselves off a spam list, so in fact it would seem this is at least potentially one of the problems, (which spam list they're on is obviously a mystery to all concerned lol) but this forum topic I've bookmarked will be a page I study relentlessly until I get the hang of it lol!! (and sorry for the poor formatting of the code!!)
Thanks d11wtq, onion2k, feyd!
All the best
Jodes
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
Here's the article I was going to write. Just a first draft - I'm kinda rushing through the wiki getting content on all page for now.
http://www.swiftmailer.org/wikidocs/v3/tips_spam
http://www.swiftmailer.org/wikidocs/v3/tips_spam