Link to home
Start Free TrialLog in
Avatar of 154115
154115Flag for Denmark

asked on

PHP's mail function with ø domain

Why does all the mails I send with PHP's mail function end in my mails spamfilter? I think it could have something to do with the "ø" in the domain name? Please tell me how to avoid that. I want the mails I'm sending with PHP's mail function to end in my mail inbox instead. But how?
$sMailTo     = "mymail@gmail.com";
    $sMailSubject    = "Message";
    $sMailMessage  = "My message";
                    
    $sMailHeaders .= "Reply-To: Domainwithø.com <noreply@domainwithø.com>\r\n";
    $sMailHeaders .= "Return-Path: Domainwithø.com <noreply@domainwithø.com>\r\n";
    $sMailHeaders .= "From: Domainwithø.com <noreply@domainwithø.com>\r\n";
    $sMailHeaders .= "Organization: Domainwithø.com\r\n";
    $sMailHeaders .= "Content-Type: text/plain\r\n";
    mail($sMailTo, $sMailSubject, $sMailMessage, $sMailHeaders);

Open in new window

Avatar of V4nP3rs13
V4nP3rs13
Flag of Bosnia and Herzegovina image

All mails sent from php function are traited as spam. I dont have any idea for fixing it
Avatar of 154115

ASKER

But how can I then send a mail from my PHP website thats not treated as spam? A lot of pages are sending automatic mails that is not ending in the spam filter. How can I do that?
hmm.. senders email must have some of the popular (trusted) domain names like hotmail.com, yahoo.com, live.com, msn.com, gmail.com etc.

So, this header:
$sMailHeaders .= "From: Domainwithø.com <noreply@domainwithø.com>\r\n";
should have trusted sender's email... it's now noreply@domainwithø.com, but it should be something@gmail.com or something@hotmail.com... etc.

That's my opinion.. try to make like mail(); function like that.
Avatar of 154115

ASKER

It doesn't work. The mail sent from PHP's mail function is still recognized as spam but I found out that it only happens in Gmail. How can I avoid Gmail's spam filter?
hello 154115, hope you can solve this, I have looked at your email code and do not see anything about it that would seem unusual and get in a spam (words like Viagra sometimes cause email to be spam). . .
SO, if I was guessing as to the cause, I would say that your server IP address was marked as "Black Listed" by google IP analyzers , you can check your server IP for black listing at -

http://www.mxtoolbox.com/blacklists.aspx

and

http://www.dnsbl.info/

there are many others to check for IP black lists
I was once on a web server that started to sell services to  just about anybody, and they had spam sent from that server, at first only a few email sent from me were marked as spam, then almost all my emails were as spam or rejected compleatly. I was not sending spam , but the server IP was black listed. I had to move to another web server.
Avatar of 154115

ASKER

It still doesn't work. My domain is not blacklisted. I still can't use PHP's mail function to send mails to Gmail accounts without them being recognized as spam. Why?
This statement is simply not true: "All mails sent from php function are traited[sic] as spam."  I send thousands of emails every month using the PHP mail command and they are not treated as spam - they contain useful, personalized information for my clients.

Before we go any further, please explain why you want phi in the sending domain name?  Also, if you have not looked into it, learn about the Sending Policy Framework.

"Why" is always the complicated question - about most things in life and the spam filters are no different.  Your server may be sending "anti-spam" headers.  Your domain may be part of a numeric sequence of IP addresses that has been identified as hosting spam.  Your message content may have something that sounds spammish, like "Dear Trusted Friend" or "Penis Enhancement Pills."

Let me try to help you out here.  Please send me one of the messages that you're having trouble with.  Send it to Ray.Paseur at my GMail address shown in my public profile here at EE.
https://www.experts-exchange.com/M_3774417.html

I will look at the message and show you what I see that may be causing your trouble.  Best, ~Ray
One other note regarding this, "How can I avoid Gmail's spam filter?"

Sometimes it is all about how you ask the question:
http://lmgtfy.com?q=gmail+whitelist
At "spam filtering" domain name and other familiarities have very less weight as compared to source IP Address

So It is very important to check your server IP address (where php script is running) against blacklist database as Slick812 has mentioned. (Not domain name! as you have did).

If your IP is not blacklisted then you have to think about  email contents. and if it is then try to use some alternative IP Address or use an email account at third party smtp service (like gmail) to send email.

 for more info google "php email smtp". or visit
http://email.about.com/od/emailprogrammingtips/qt/PHP_Email_SMTP_Authentication.htm
Avatar of 154115

ASKER

Hi Ray. I just mailed you. Thx a lot. I'm exited to hear what you have to say about it.
Here is the entire message as received by GMail, including all the headers.
Delivered-To: ray.paseur@gmail.com
Received: by 10.220.97.67 with SMTP id k3cs42872vcn;
        Sun, 28 Mar 2010 07:23:29 -0700 (PDT)
Received: by 10.150.56.14 with SMTP id e14mr3679099yba.339.1269786209599;
        Sun, 28 Mar 2010 07:23:29 -0700 (PDT)
Return-Path: <xn--lbong-uua.dk_i54656@server602.serverpark.dk>
Received: from server602.serverpark.dk (server602.serverpark.dk [86.58.154.9])
        by mx.google.com with ESMTP id 37si2022829yxe.123.2010.03.28.07.23.29;
        Sun, 28 Mar 2010 07:23:29 -0700 (PDT)
Received-SPF: pass (google.com: domain of xn--lbong-uua.dk_i54656@server602.serverpark.dk designates 86.58.154.9 as permitted sender) client-ip=86.58.154.9;
Authentication-Results: mx.google.com; spf=pass (google.com: domain of xn--lbong-uua.dk_i54656@server602.serverpark.dk designates 86.58.154.9 as permitted sender) smtp.mail=xn--lbong-uua.dk_i54656@server602.serverpark.dk
Received: from server602.serverpark.dk (localhost.localdomain [127.0.0.1])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by server602.serverpark.dk (Postfix) with ESMTP id 119E98F60244
	for <Ray.Paseur@gmail.com>; Sun, 28 Mar 2010 16:23:52 +0200 (CEST)
Received: (from xn--lbong-uua.dk_i54656@localhost)
	by server602.serverpark.dk (8.13.8/8.13.8/Submit) id o2SENqQN016738;
	Sun, 28 Mar 2010 16:23:52 +0200
Date: Sun, 28 Mar 2010 16:23:52 +0200
Message-Id: <201003281423.o2SENqQN016738@server602.serverpark.dk>
To: Ray.Paseur@gmail.com
Subject: Hi Ray_Paseur
Reply-To: "¿lbong.dk" <noreply@xn--lbong-uua.dk>
From: <noreply@xn--lbong-uua.dk>
Organization: ¿lbong.dk
Content-Type: text/plain


This mail is a testmail from my ¿-domain. Thx for helping. Johnny

Open in new window

I am guessing that the inverted question marks rendered here are the Greek letter phi in the original?  

Looks like there is nothing from the server, like anti-spam headers.

The SPF passed for xn--lbong-uua.dk

A visit to xn--lbong-uua.dk appears to redirect to http://ølbong.dk/

Can you please try the email again with the reply-to address changed so that there is no phi?
Avatar of 154115

ASKER

I just mailed you again. I changed the mail address in the header to ølbong.dk instead of xn--lbong-uua.dk.
Similar results.  Have you tried specifying that you are using UTF-8 characters?  The content-type in the headers does not list an encoding.  Maybe that would be helpful.

Reply-To: "¿lbong.dk" <noreply@¿lbong.dk>

Can we test with all the phi characters removed, please?
Delivered-To: ray.paseur@gmail.com
Received: by 10.220.97.67 with SMTP id k3cs43407vcn;
        Sun, 28 Mar 2010 07:56:44 -0700 (PDT)
Received: by 10.100.233.9 with SMTP id f9mr187019anh.182.1269788204198;
        Sun, 28 Mar 2010 07:56:44 -0700 (PDT)
Return-Path: <xn--lbong-uua.dk_i54656@server602.serverpark.dk>
Received: from server602.serverpark.dk (server602.serverpark.dk [86.58.154.9])
        by mx.google.com with ESMTP id 11si2008695yxe.10.2010.03.28.07.56.43;
        Sun, 28 Mar 2010 07:56:44 -0700 (PDT)
Received-SPF: pass (google.com: domain of xn--lbong-uua.dk_i54656@server602.serverpark.dk designates 86.58.154.9 as permitted sender) client-ip=86.58.154.9;
Authentication-Results: mx.google.com; spf=pass (google.com: domain of xn--lbong-uua.dk_i54656@server602.serverpark.dk designates 86.58.154.9 as permitted sender) smtp.mail=xn--lbong-uua.dk_i54656@server602.serverpark.dk
Received: from server602.serverpark.dk (localhost.localdomain [127.0.0.1])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by server602.serverpark.dk (Postfix) with ESMTP id 8B0C62FA8001
	for <Ray.Paseur@gmail.com>; Sun, 28 Mar 2010 16:57:06 +0200 (CEST)
Received: (from xn--lbong-uua.dk_i54656@localhost)
	by server602.serverpark.dk (8.13.8/8.13.8/Submit) id o2SEv645024019;
	Sun, 28 Mar 2010 16:57:06 +0200
Date: Sun, 28 Mar 2010 16:57:06 +0200
Message-Id: <201003281457.o2SEv645024019@server602.serverpark.dk>
To: Ray.Paseur@gmail.com
Subject: Hi again Ray_Paseur
Reply-To: "¿lbong.dk" <noreply@¿lbong.dk>
From: <noreply@¿lbong.dk>
Organization: ¿lbong.dk
Content-Type: text/plain


This mail is the SECOND testmail from my ¿-domain. Thx for helping. Johnny

Open in new window

Avatar of 154115

ASKER

How can I specify that? Thank you for being so patient. Right now I'm sending mail like this:

    $sMailTo     = "your mail address ray";
    $sMailSubject    = "Hi again Ray_Paseur";
    $sMailMessage  = "This mail is the SECOND testmail from my ø-domain. Thx for helping";
                     
    $sMailHeaders .= "Reply-To: Ølbong.dk <noreply@ølbong.dk>\r\n";
    $sMailHeaders .= "Return-Path: Ølbong.dk <noreply@ølbong.dk>\r\n";
    $sMailHeaders .= "From: <noreply@ølbong.dk>\r\n";
    $sMailHeaders .= "Organization: Ølbong.dk\r\n";
    $sMailHeaders .= "Content-Type: text/plain\r\n";
    mail($sMailTo, $sMailSubject, $sMailMessage, $sMailHeaders);
Please try this one for me.
<?php // RAY_temp_mail_test.php
error_reporting(E_ALL);
mail('Ray.Paseur@Gmail.com', 'phi test message', 'Hello World');

Open in new window

After we test that simplistic mail command, we can start trying to build up the headers till we see what goes awry.
While we are working on the email, you might enjoy this video from the Onion.
http://www.theonion.com/video/denmark-introduces-harrowing-new-tourism-ads-direc,14403/
Avatar of 154115

ASKER

lol funny video :o)
Yeah, I love the Onion!
Avatar of 154115

ASKER

ok the mail is sent :-)
OK, here is the simple one.  And it went into the GMail spam folder.
Delivered-To: ray.paseur@gmail.com
Received: by 10.220.97.67 with SMTP id k3cs43738vcn;
        Sun, 28 Mar 2010 08:21:17 -0700 (PDT)
Received: by 10.100.233.7 with SMTP id f7mr6315434anh.91.1269789677846;
        Sun, 28 Mar 2010 08:21:17 -0700 (PDT)
Return-Path: <xn--lbong-uua.dk_i54656@server602.serverpark.dk>
Received: from server602.serverpark.dk (server602.serverpark.dk [86.58.154.9])
        by mx.google.com with ESMTP id 16si1212618yxe.111.2010.03.28.08.21.17;
        Sun, 28 Mar 2010 08:21:17 -0700 (PDT)
Received-SPF: pass (google.com: domain of xn--lbong-uua.dk_i54656@server602.serverpark.dk designates 86.58.154.9 as permitted sender) client-ip=86.58.154.9;
Authentication-Results: mx.google.com; spf=pass (google.com: domain of xn--lbong-uua.dk_i54656@server602.serverpark.dk designates 86.58.154.9 as permitted sender) smtp.mail=xn--lbong-uua.dk_i54656@server602.serverpark.dk
Received: from server602.serverpark.dk (localhost.localdomain [127.0.0.1])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by server602.serverpark.dk (Postfix) with ESMTP id 2B2432FA8001
	for <Ray.Paseur@Gmail.com>; Sun, 28 Mar 2010 17:21:40 +0200 (CEST)
Received: (from xn--lbong-uua.dk_i54656@localhost)
	by server602.serverpark.dk (8.13.8/8.13.8/Submit) id o2SFLeaq029492;
	Sun, 28 Mar 2010 17:21:40 +0200
Date: Sun, 28 Mar 2010 17:21:40 +0200
From: i54656 <xn--lbong-uua.dk_i54656@server602.serverpark.dk>
Message-Id: <201003281521.o2SFLeaq029492@server602.serverpark.dk>
To: Ray.Paseur@Gmail.com
Subject: phi test message

Hello World

Open in new window

Avatar of 154115

ASKER

yes unfortunately
Avatar of 154115

ASKER

So there is nothing to do about it?
have you read my comments about third party SMTP service
There is plenty you can do.  Find out why there is a blacklist for your server IP address and get that corrected.  Then contact Google and tell them that you are not sending spam.  Ask for their advice. Their developers are usually very helpful.

You might also consider using Constant Contact or a similar service.  After years of doing it ourselves at my church we switched to ConstantContact.com for email broadcasts.  There are competing services, but out staff liked the interface at CC the best. Costs are minimal - we send many hundreds of messages each week for pennies a day.  The advantage of using a service like Constant Contact is that you can spend your time focused on your work and let them worry about the spam-filter issues.

Best regards, ~Ray
Avatar of 154115

ASKER

nasirbest:
I can't figure out how to install PEAR Mail package on my remote server. I would love to use a third party SMTP service if i could find one that could send mail to Gmail. I just need to be able to send the message automatically from my site. Thats all I require.
My candid suggestion: Change the return address on your email messages.  Find a way to live without the @ølbong.dk part of the email.

Consider getting in touch with Constant Contact and asking them what they know about this issue.  Show them this thread and also this link.  Hopefully they can offer some suggestions.
https://www.experts-exchange.com/questions/25561178/PHP-mail-DKIM-DomainKey-authentication.html?anchorAnswerId=28905201#a28905201

Here is the screen capture from an attempt to identify the URL via one of the major USA registrars for domain names (see the part in red).
lbong3.png
ASKER CERTIFIED SOLUTION
Avatar of nasirbest
nasirbest
Flag of Pakistan image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of 154115

ASKER

Oh my god!! I was almost giving up but PHPMailer did the job. Now I'm able to send mail through my gmail accound. I used this tutorial:

http://www.web-development-blog.com/archives/send-e-mail-messages-via-smtp-with-phpmailer-and-gmail/

Thank you very much nasirbest - and to you 2 Ray_Paseur for using so much time trying to find a good solution. I appreciate that :o)

Best regards
Johnny
pleased to know that at last you found the solution,  

but you mistakenly requested to close this question instead of choosing the right expert who helped you to solve it!
Avatar of 154115

ASKER

Sorry. A mistake :-)