6

I try to send email from our server using php and Zend_Mail. I use smtp transport. This is confimation email of subscribing. But for some reason email that I send has strange headers and email goes to spam folder (I see them in gmail that receive letter):

 Message-Id: <50ee94f7.84fc440a.62dc.ffff9685SMTPIN_ADDED_MISSING@mx.google.com>
    Received: (qmail 10943 invoked from network); 10 Jan 2013 10:16:22 -0000
    Received: from unknown (HELO searchboxindustries.com)  (username@searchboxindustries.com@207.162.215.30)

What does it mean list header "Recieved: from unknown"? Can it make email go to spam? How to avoid this strange header and make email avoid spam folder? Is there any problem with coode or maybe I have some problems with DNS settings of this domain?

Here's code for setting headers:

$mailer->setFrom($params['list_email'], $params['list_from_name']);
$mailer->setReplyTo($params['list_email']);

$mailer->addHeader('Sender', $params['list_email'] . '.searchboxindustries.com');                       
$mailer->setReturnPath($params['list_email'] . '.searchboxindustries.com');         

$mailer->addTo($params['email_address']);

Code to configure transport:

$emailConfig = $this->getOption('email');                                   
        $transport = new Zend_Mail_Transport_Smtp($emailConfig['server'], $emailConfig);
Zend_Mail::setDefaultTransport($transport);

Email config from application.ini:

   email.name  = searchboxindustries.com
   email.server = searchboxindustries.com
   email.username = user_name
   email.password = password
   email.auth = plain
   email.port = 587

Here are headers of such email:

Delivered-To: gala19612009@gmail.com
Received: by 10.76.94.204 with SMTP id de12csp111150oab;
        Fri, 11 Jan 2013 01:58:49 -0800 (PST)
X-Received: by 10.69.0.8 with SMTP id au8mr228881813pbd.58.1357898329423;
        Fri, 11 Jan 2013 01:58:49 -0800 (PST)
Return-Path: <opp@mail15.com.searchboxindustries.com>
Received: from smtp1-1.searchboxindustries.com (mta1.searchboxindustries.com. [207.162.215.30])
        by mx.google.com with SMTP id d7si4727205paw.95.2013.01.11.01.58.48;
        Fri, 11 Jan 2013 01:58:48 -0800 (PST)
Received-SPF: pass (google.com: domain of opp@mail15.com.searchboxindustries.com designates 207.162.215.30 as permitted sender) client-ip=207.162.215.30;
Authentication-Results: mx.google.com;
       spf=pass (google.com: domain of opp@mail15.com.searchboxindustries.com designates 207.162.215.30 as permitted sender) smtp.mail=opp@mail15.com.searchboxindustries.com
Message-Id: <50efe258.a74b420a.3351.12fcSMTPIN_ADDED_MISSING@mx.google.com>
Received: (qmail 21583 invoked from network); 11 Jan 2013 09:58:48 -0000
Received: from unknown (HELO searchboxindustries.com) (username@searchboxindustries.com@207.162.215.30)
  by searchboxindustries.com with SMTP; 11 Jan 2013 09:58:48 -0000
From: Oleg <opp@mail15.com>
Reply-To: opp@mail15.com
Sender: opp@mail15.com.searchboxindustries.com
Return-Path: opp@mail15.com.searchboxindustries.com
To: gala19612009@gmail.com
Subject: List1: Confirm Subscription
Date: Fri, 11 Jan 2013 04:58:48 -0500
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline
MIME-Version: 1.0

Spf seems to be ok. The ip from which email is sent is not blacklisted.

Now there are changes in DNS and I have headers:

Message-Id: <50f41c80.67e3440a.2d32.6aabSMTPIN_ADDED_MISSING@mx.google.com>
Received: (qmail 18457 invoked from network); 14 Jan 2013 14:55:59 -0000
Received: from unknown (HELO smtp1-1.searchboxindustries.com) (username@searchboxindustries.com@207.162.215.30)
  by searchboxindustries.com with SMTP; 14 Jan 2013 14:55:59 -0000

We have Reverse DNS set. 207.162.215.30 is resolved to stmp1.searchboxindustries.com. What's the problem then? I wonder what is strange format in brackets in the header Received : from unknow:

 username@searchboxindustries.com@207.162.215.30
Oleg
  • 2,733
  • 7
  • 39
  • 62
  • Do you have details about spam filter resolution? As a rule, you can setup receiving server to output which spam rules were triggered. – Stan Jan 11 '13 at 09:02
  • No I don't have any spam filter resolutions, I see headers in gmail. – Oleg Jan 11 '13 at 09:13
  • Well, it's hard to remove spam resolution if it's unknown which part of your message treated as suspicious. As for `unknown`, I've found that this happens, when receiving end can not check your smtp-server IP using reverse DNS: either it can't extract IP from "(username@searchboxindustries.com@207.162.215.30)", or may be it founds that reverse DNS-ed domain "mta1.searchboxindustries.com" is not equal to "searchboxindustries.com". I'm not sure about that. – Stan Jan 11 '13 at 09:33
  • Could you plesae tell what's problem with DNS related to uknown? – Oleg Jan 11 '13 at 09:44
  • I can't understand what it tries to resolve. – Oleg Jan 11 '13 at 09:47
  • I don't understand what address it tries to resolve using DNS when received email and fails. – Oleg Jan 11 '13 at 09:48
  • Just a guess: try to make `return-path` equal to `from` and remove `sender`. – Stan Jan 11 '13 at 10:24
  • This headers still remain if I make return-path equal from and remove sender, the differece if that email doesn't have Sender and return-path equal to from: Received: (qmail 24384 invoked from network); 11 Jan 2013 10:31:14 -0000 Received: from unknown (HELO searchboxindustries.com) (smtpauth@searchboxindustries.com@207.162.215.30) by searchboxindustries.com with SMTP; 11 Jan 2013 10:31:14 -0000 – Oleg Jan 11 '13 at 10:32
  • My suggestion was not for removing "unknown" header, but as a possible mean for eliminating it from spam. So check once again if it helps. We can't take it for granted that the "unknown" is responsible for "spamness" of your mails. – Stan Jan 11 '13 at 11:48
  • I need different email address for returnPath and from, I need bounced emails go to other addresses. – Oleg Jan 15 '13 at 05:03
  • I made changes in the message to reflect new headers. – Oleg Jan 15 '13 at 05:10

3 Answers3

3

The Received: from unknown simply means that one SMTP server receiveid it from another which did not provide reverse DNS. Typically each hop from one SMTP server to another adds one Received: header at the top of the message (except qmail, which adds two; this is visible in your example).

If you are concerned about the lack of reverse DNS, and if 207.162.215.30 is yours, then perhaps you can convince your ISP to provide reverse DNS for it. Many ISPs refuse (if you are on a "consumer" broadband plan), or will require a different hosting contract with you in order to offer this service. ("Reverse DNS" means that when somebody queries DNS for "what's the DNS name of 207.162.215.30" the answer would be "searchboxindustries.com" or perhaps another host name, but not "unknown".)

The reverse DNS lookup is usually performed based on the TCP headers, not on the text of the message. If the SMTP server receives a connection from 123.45.67.89 then it will perform reverse DNS for that address, and put the results in the Received: header it adds. In other words, the contents of your message headers or envelope headers do not affect this outcome at all.

Recipients can do whatever they want with these headers. It is unlikely that this header alone (the presence of this header, or the absence of reverse DNS information evident from the contents of it) would be sufficient for somebody to classify your message as spam, but there is really no way to control what the recipient does with this information.

If anything, your question is an indication that perhaps you should be looking at a professional service to send out these messages on your behalf, for a fee.

tripleee
  • 175,061
  • 34
  • 275
  • 318
  • But we have reverse DNS: 207.162.215.30 is resolved to smtp1-1.searchboxindustries.com. Could you please explain what's the problem then? It's still says: Received: from unknown (HELO smtp1-1.searchboxindustries.com) (username@searchboxindustries.com@207.162.215.30) by searchboxindustries.com with SMTP; 15 Jan 2013 11:08:08 -0000 – Oleg Jan 15 '13 at 13:32
  • Then I don't know. Could be that the server cannot access DNS, or was simply configured to not do DNS lookups at all (i.e. put "unknown" for all servers), usually for performance reasons. By the looks of it, this is your own server; if you are not the admin, talk to someone who is. – tripleee Jan 15 '13 at 14:54
  • Could you please tell me about configuring SMTP server about not to use DNS lookup? I didn't know it can ignore DNS lookup and always use uknown. – Oleg Jan 15 '13 at 15:10
  • Could you please explain where this setting can be? – Oleg Jan 15 '13 at 15:19
  • 1
    This is already far off-topic for StackOverflow. Please post a follow-up question on a forum where email configuration discussions are acceptable, and of course, supply the necessary details about the mail server software version and platform. – tripleee Jan 15 '13 at 17:33
0

Try the following options to find where the problem is:

  1. Does the email has body? I believe there is email body.
  2. For isolating the problem, you can try it using another alternative SMTP (for example: gmail smtp).
  3. Alternatively, you can use PHP mail directly without smtp.
e-sushi
  • 13,786
  • 10
  • 38
  • 57
Wasim
  • 1,146
  • 11
  • 25
  • I don't understand what you mean. Could you please be more concrete. Yes, I have the body of email, it's confimation email. – Oleg Jan 11 '13 at 10:24
  • I don't need alternative Stmp server, as I use our smtp server. Could you be more more concrete? – Oleg Jan 11 '13 at 10:35
  • You might test using via another SMTP server instead of your existing one to test whether your SMTP server is working well or not. – Wasim Jan 11 '13 at 11:14
  • I don't need other SMTP server, there is concrete server, info about headers and code. Could you tell what's the problem and how to solve it? – Oleg Jan 11 '13 at 11:16
0

My server requires an extra (php.)ini setting, might that solve your issue?

ini_set('sendmail_from', 'enterAValidEmailAddr@yourDomainHere');
inhan
  • 7,394
  • 2
  • 24
  • 35
  • I use smtp, I don't understand what you mean. Headers of email and code I posted. Could you please explain? – Oleg Jan 11 '13 at 11:17
  • I'm not familiar with Zend_Mail and I'm using the default [**`mail()`**](http://php.net/manual/en/function.mail.php) function to send emails so I'm afraid I can't help you translate my suggestion into Zend_Mail. Perhaps someone familiar with this class might shed you a light. – inhan Jan 11 '13 at 11:24
  • I'm not sure this problem related is related to zend_mail. – Oleg Jan 11 '13 at 13:30