php mail() ending up in Junk folder for Web Based Email!

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
myleow
Forum Contributor
Posts: 194
Joined: Mon Jun 21, 2004 7:05 pm
Location: California

php mail() ending up in Junk folder for Web Based Email!

Post by myleow »

Dear All,

I would greatly appreciate any help i can get.

I wrote a script that will send an email from my server using mail() but it is ending up in Junk folders for Web Based email services. My friend set up his own email server and it did not end up in the Junk department.

Is it because of spam filtering? It is a legitimate email being sent from my homepage. Below is the code, please help me fix it.

Code: Select all

//Send email to non-member

$mail_to = $token_array[1];

$mail_from = $email_addr;

$mail_headers = "To: $mail_to\r\nFrom: $mail_from\r\nReply-to:$mail_reply_to\r\nCc:$mail_cc\r\nBcc: $mail_bcc\r\n";

$mail_subject = "Invitation from ".ucwords($_SESSION["firstname"])." ".ucwords($_SESSION["lastname"]);

$mail_body = "Hi there!";

if (mail($mail_to, $mail_subject, $mail_body, $mail_headers))
{
  //Do stuff to DataBase
}
Thank you in advance.

Regards
Mian


feyd|please use

Code: Select all

tags when posting code.[/color]
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

it could be a multitude of things, your provider, some of your headers or mail settings..

Check the headers in the email you received for something like "misconfigured headers" or other bad idicators.
myleow
Forum Contributor
Posts: 194
Joined: Mon Jun 21, 2004 7:05 pm
Location: California

How to check the header information?

Post by myleow »

I am using Hotmail and Yahoo to test. How to dissect the header?

What is the correct HEADER form that should be used?

Basically i am using Apache as my server and EXIM as email server with Sendmail wrapper. I have registered my domain and am hosting it from home through SBC DSL.

Regards
Mian
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

it's generally in the extra details or similar.. uh..

in hotmail:
go into your "mail" options, you should see "Message headers" on the left. Select "Advanced";
Once you complete that, you will see some strange looking stuff just under the subject line of a recieved email. Copy and Paste that here, so we can look at it. :)

for yahoo:
go into "Mail Options", "General Preferences", under "Messages" there's a item called "Headers". Select "show all";
you should now see the headers (similar to Hotmail) in all emails.
myleow
Forum Contributor
Posts: 194
Joined: Mon Jun 21, 2004 7:05 pm
Location: California

Header is here....

Post by myleow »

======THIS IS FROM MY SERVER TO HOTMAIL======

X-Message-Info: JGTYoYF78jHLpZwr7v3omBPLll0DeRaa
Received: from icees ([64.168.26.213]) by mc3-f30.hotmail.com with Microsoft SMTPSVC(5.0.2195.6824);
Sat, 19 Jun 2004 18:56:09 -0700
Received: from www-data by icees with local (Exim 3.35 #1 (Debian))
id 1BbrRP-0006cU-00; Sat, 19 Jun 2004 18:48:15 -0700
To: myleow@hotmail.com
Subject: Invitation from andy lau
To: myleow@hotmail.com
From: ap26@yahoo.com
Reply-to:
Cc:
Message-Id: <E1BbrRP-0006cU-00@icees>
Date: Sat, 19 Jun 2004 18:48:15 -0700
Return-Path: www-data@icees.com
X-OriginalArrivalTime: 20 Jun 2004 01:56:09.0295 (UTC) FILETIME=[C19B45F0:01C45669]



======THIS IS FROM MONSTER to my Hotmail======

MIME-Version: 1.0
X-Sender: cm-sxdi5magjlocksmy04ca1@route.deliverymail.com
Received: from mailman2.ma.tmpw.net ([63.112.170.13]) by mc12-f25.hotmail.com with Microsoft SMTPSVC(5.0.2195.6824); Mon, 21 Jun 2004 09:47:46 -0700
Received: (qmail 23831 invoked from network); 21 Jun 2004 16:47:45 -0000
Received: from campaign101.ma.monster.com (10.50.11.97) by mailman2-q1.ma.tmpw.net with SMTP; 21 Jun 2004 16:47:45 -0000
Received: from mail pickup service by campaign101.ma.monster.com with Microsoft SMTPSVC; Mon, 21 Jun 2004 11:47:42 -0500
X-Message-Info: JGTYoYF78jG/fCVArkM3nMNwtm0yUhr3
X-Mailer: MIME::Lite 2.111 (B2.12)
Message-ID: <CAMPAIGN101mcK8r6be0008958e@campaign101.ma.monster.com>
X-OriginalArrivalTime: 21 Jun 2004 16:47:42.0637 (UTC) FILETIME=[78893DD0:01C457AF]
Return-Path: cm-sxdi5magjlocksmy04ca1@route.deliverymail.com

====================================

Do i just simply encode teh header information, such as reply-to, Return-Path in the header information to eliminate the www-data which is Apache from the message header?
d3ad1ysp0rk
Forum Donator
Posts: 1661
Joined: Mon Oct 20, 2003 8:31 pm
Location: Maine, USA

Post by d3ad1ysp0rk »

$mail_reply_to is never set, therefore hotmail does not recognize the header and sends it to the junk mail folder.

Code: Select all

$mail_reply_to = "noreply@myserver.com";
should fix it.
myleow
Forum Contributor
Posts: 194
Joined: Mon Jun 21, 2004 7:05 pm
Location: California

I will try that

Post by myleow »

Will tell you the result.
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Post by pickle »

It is also entirely possible it is getting flagged as SPAM. The body of the email being only "Hi There!" probably sets off a few flags. Also, the return address being different from the one that sent the email is likely a cause.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
myleow
Forum Contributor
Posts: 194
Joined: Mon Jun 21, 2004 7:05 pm
Location: California

Tried again but still failing SPAM detection

Post by myleow »

This is the Header from my Yahoo account. I just tried it again with reply-to: field set to the From: field but it is still sending me to Junk mail.

Pleaes help.

==============================

X-Apparently-To: myleow@yahoo.com via 66.218.93.84; Thu, 24 Jun 2004 16:06:00 -0700
X-YahooFilteredBulk: 64.168.26.213
X-Originating-IP: [64.168.26.213]
Return-Path: <www-data@icees.com>
Received: from 64.168.26.213 (EHLO icees) (64.168.26.213) by mta275.mail.scd.yahoo.com with SMTP; Thu, 24 Jun 2004 16:06:00 -0700
Received: from www-data by icees with local (Exim 3.35 #1 (Debian)) id 1BddF1-0008Ei-00; Thu, 24 Jun 2004 16:02:47 -0700
To: myleow@yahoo.com
Subject: Invitation from Pearl Tong to ICEES network
To: myleow@yahoo.com
From: pearl_t_us@yahoo.com Add to Address Book
Reply-to: pearl_t_us@yahoo.com
CC:
Message-Id: <E1BddF1-0008Ei-00@icees>
Date: Thu, 24 Jun 2004 16:02:47 -0700
Content-Length: 359

=====================================

Oh and on top where i have a Message Body, the message is not just Hi There. I just cut off the rest to show that i did enter something.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

try using "Reply-To:"
myleow
Forum Contributor
Posts: 194
Joined: Mon Jun 21, 2004 7:05 pm
Location: California

Reply-to and Reply-To gives the same result.

Post by myleow »

Well using both will get me Reply-To to someone i want.

The one thing i notice from regular email and the email that i wanted to mask, is the Return-Path:

Normally the Return-Path is the same with From: or Reply-To: but mine is set to Return-Path: www-data.icees.com

I tried masking it by adding Return-Path:$email into the Header but it doesn't work. I am still getting www-data@icees.com as the person for Return-Path.

I think that is the problem, anyone know how to fix this, please?

Regards
Mian
Post Reply