rubysmtpdebianhostblocked

Email header shows "received from 127.0.0.1"


I hang on this problem for weeks now...

I send mails from my server (debian 8 over ruby 1.8.7 NET::SMTP) over a another smtp server.

A sent email have the following header

Return-Path: <sender@mail.com>
Received: from XXXDOMAIN ([xxx.xxx.xxx.xxx]) by
 XXX MAILSERVER
 17:13:40 +0100
Received: from 127.0.0.1 (REALDOMAIN [REALIP]) by
 REALMAILSERVERDOMAIN
 Tue, 15 Mar 2016 16:13:38 +0000
Date: Tue, 15 Mar 2016 17:13:37 +0100
From: admin <sender@mail.com>
To: recepient@mail.com

The server gets blocked by the cbl, because of the 127.0.0.1. REAL PROBLEM FROM CBL: The listing of this IP is because it HELOs as 127.0.0.1

If I make a EHLO over telnet everything is ok, but if I send a mail from ruby, I get the wrong header.

My /etc/hosts:

# nameserver config
# IPv4
127.0.0.1 jupiter
127.0.0.1 localhost.localdomain localhost
xxx.xxx.xxx.xxx  jupiter.domain.com jupiter
#
# IPv6
xxx     ip6-localhost ip6-loopback
xxx ip6-localnet
xxx ip6-mcastprefix
xxx ip6-allnodes
xxx ip6-allrouters
xxx ip6-allhosts
xxxipv6stringxxx  jupiter

It would be great, if you have a solution for me.

Thank you!


Solution

  • I found the problem...

    In ruby you set the domain and we set it to '127.0.0.1'....

      ActionMailer::Base.smtp_settings = {
        :address => $config[:mail_smtp_host],
        :port => $config[:mail_smtp_port].to_s,
        :user_name => $config[:mail_smtp_username],
        :password => $config[:mail_smtp_password],
        :authentication => $config[:mail_smtp_authtype],
        :domain => $config[:mail_smtp_domain]  ## HERE must be the domain
      }