email from php form going getting filtered as spam


I am sending a verification email to my new users and I am having an issue with it getting filtered out on gmail and a couple others but it does delver to some.

I would love any pointers.
$subject = " || User Varification";
    $message = "
Dear $first_name $last_name,
Thank you for registering!
You are two steps away from joining
To activate your membership,
please click here:$userid&code=$db_password
Once you activate your memebership, you will be able to login with the following information:
Username: $username
Password: $random_password
Thank you, Staff
This is an automated response, please do not reply!"; 
    mail($email_address, $subject, $message, 
        "From: <>\n" );

Open in new window

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ensure that your email address is a VALID email address and if a  test mail was sent it would be able to verify.

also check your reverse records are also valid

I agree with Benji generally the problem is that you don't have a proper HELO it may be using root@localhost or the like.

If you are using your own webserver I would advise you change your sendmail outgoing mail host.  If it isn't contact the help desk for your webserver and they may be able to assist you with the problem.

Sorry I can't be more help but your code appears to be solid, I think it is just a server problem.
movieprodwAuthor Commented:
I am using

does that sound wrong?
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

if you email  does the email arrive at an inbox or is that box not createD?
movieprodwAuthor Commented:

I talked with my server and they said that they set a SPR or something that will make it so that it will work?

I will let you know.

Thanks for your tips!
NerdsOfTechTechnology ScientistCommented:
Also double check the spelling. A lot of people don't know this but SPAM FILTERS keep an eye out for MISSPPEEELLLINGS :) Especially in the SUBJECT

Avoid using special characters like PIPE '|'
I would suggest using this subject instead

$subject = "Email Validation - Thank you for registering with";
movieprodwAuthor Commented:
I will try that!

It is still getting blocked and that could be it
movieprodwAuthor Commented:

I did change the subject and still nothing. So I copied and pasted the email into my mail program and sent it from my computer using the same email/subject/message and it worked just fine

I have the email below, please let me know if you see anything.
Dear Bob Lastname,
Thank you for registering!
You are two steps away from joining
To activate your membership,
please click here:
Once you activate your membership, you will be able to log in with the following information:
User name: Matt
Password: 914hjv7p
Thank you, Staff
This is an automated response, please do not reply!

Open in new window

NerdsOfTechTechnology ScientistCommented:
maybe it is your from address? to short? would be a better from address maybe?
NerdsOfTechTechnology ScientistCommented:
I agree with the other experts. it sounds like the email server is the issue then.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
movieprodwAuthor Commented:
I got some interesting info from the log!
Email from =
[Sun Apr 26 14:51:17 2009] [error] [client] PHP Notice: Undefined index: msg in /var/www/vhosts/ on line 4
[Sun Apr 26 14:55:15 2009] [error] [client] PHP Notice: Undefined variable: first_name in /var/www/vhosts/ on line 6
[Sun Apr 26 14:55:15 2009] [error] [client] PHP Notice: Undefined variable: last_name in /var/www/vhosts/ on line 10
[Sun Apr 26 14:55:15 2009] [error] [client] PHP Notice: Undefined variable: email_address in /var/www/vhosts/ on line 14
[Sun Apr 26 14:55:15 2009] [error] [client] PHP Notice: Undefined variable: username in /var/www/vhosts/ on line 18
[Sun Apr 26 14:55:15 2009] [error] [client] PHP Notice: Undefined variable: info in /var/www/vhosts/ on line 21
[Sun Apr 26 14:55:27 2009] [error] [client] PHP Notice: Undefined variable: pass in /var/www/vhosts/ on line 98, referer:

Open in new window

I may be way off target here but is it possible that your php form is being abused?

In your PHP do you have any functions that check for the use of "content-type:", "charset=", "mime-version:", "multipart/mixed", "cc:", "bcc:" in the variables received for email?  These can be used to send spam using the sendmail on your server which could lead to you being blacklisted on spam servers such as spamhaus (or the gmail equivalent).  If you are blacklisted you could find that that is what is causing your emails to be bounced as spam.

When an email gets filtered as spam do you receive a server message letting you know why?  Or is there anything attached to the email at the receivers end that lists the reason for it being blocked, even if it is just server gibberish?

note:  I just checked your websites ip in a majority of spam blacklists and you appear clear, but it is still something to be careful of.  Perhaps you would be best with a new PHP email script.  I have listed the full script I wrote for all of my php email forms at  (last answer) perhaps give it a try as it may be something in your php method causing the problem.
movieprodwAuthor Commented:
Ok, so I tried craybe's script and could not get it to work so I decieded that if I authenticated the SMTP then it would have to work right!

I installed pear on my server and ran the script below, once again, it goes to my some emails but still gets blocked from hotmail, google, yahoo!

Any suggestions would be appreciated!
// include PEAR mail classes
$recipients = "";
$headers["From"] = "";
$headers["To"] = "";
$headers["Subject"] = "User feedback";
$mailmsg = "Hello, This is a test.";
/* SMTP server name, port, user/passwd */
$smtpinfo["host"] = "";
$smtpinfo["port"] = "25";
$smtpinfo["auth"] = true;
$smtpinfo["username"] = "";
$smtpinfo["password"] = "dd";
/* Create the mail object using the Mail::factory method */
$mail_object =& Mail::factory("smtp", $smtpinfo);
/* Ok send mail */
$mail_object->send($recipients, $headers, $mailmsg);

Open in new window

Spam checks from your domain are NOT going to take affect straight away it takes between 7 -28days for the system to unblock your domain aslong as your emails arriving in correct format and no one is using your domain to spam.

Hope this helps:D
movieprodwAuthor Commented:
Ok but I own a domain and its getting blocked from that one also, its extremely unlikely that any spammer has spammed my own account.

And don't you think its odd that I can send a domain an email using the same account from my email at it works but not from my script?
Can you get your hands on the headers of one of these messages? Like send it to your own gmail account or something. It'll be really helpful to see what the message looks like on the receiving end.

I was going to suggest using the pear mail package, but I see from a couple posts above you're already using it.

Are you trying to deliver these message directly to the recipients or sending to your hosting company's relay server first? If not, I'd suggest forwarding to their relay and let it deliver the messages.
movieprodwAuthor Commented:

I am sending it from my smtp through the pear script.

Jar mentioned sending it through the hosting relay server, how would I do that?
movieprodwAuthor Commented:
Thanks for all your help, it is still doing it but I have just routed my emails around the issue.

Thanks again!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Email Servers

From novice to tech pro — start learning today.