Problem with Postfix/DNS

Discussion in 'Site & Server Administration' started by ThomasNederman, Sep 16, 2006.

  1. #1
    I have implemented a system that redirects site.com to www.site.com. I do this by having a CNAME in the DNS pointing to my redirect server. Everything works great. However, yesterday when i was going to send an e-mail from one of my sites using my redirect server. the E-mail got the name of my redirect CNAME. bellow you will find a header of my e-mail

    Return-Path: <thomas @ redirect.tne-url.com>
    X-Original-To: thomas @ thomasnederman.com
    Delivered-To: thomas @ thomasnederman.com
    Received: from localhost (localhost [127.0.0.1])
    by mail.thomasnederman.com (Postfix) with ESMTP id 085BA382009C
    for <thomas @ thomasnederman.com>; Sat, 16 Sep 2006 13:07:50 +0200 (CEST)
    Received: from mail.thomasnederman.com ([127.0.0.1])
    by localhost (tnsrv01 [127.0.0.1]) (amavisd-new, port 10024) with LMTP
    id 03338-08 for <thomas @ thomasnederman.com>;
    Sat, 16 Sep 2006 13:07:38 +0200 (CEST)
    Received: from tnsrv01.thomasnederman.com (localhost [127.0.0.1])
    by mail.thomasnederman.com (Postfix) with ESMTP id 64CEC3820082
    for <thomas @ thomasnederman.com>; Sat, 16 Sep 2006 13:07:38 +0200 (CEST)
    Received: (from apache@localhost)
    by tnsrv01.thomasnederman.com (8.13.1/8.13.1/Submit) id k8GB7cIk008970;
    Sat, 16 Sep 2006 13:07:38 +0200
    Date: Sat, 16 Sep 2006 13:07:38 +0200
    X-Authentication-Warning: tnsrv01.thomasnederman.com: apache set sender to thomas @ aconcagua.se using -f
    To: thomas @ thomasnederman.com
    Subject: Test message
    Received: from 80.170.21.2 (auth. user thomas @ aconcagua.se @ mail.thomasnederman.com)
    by mail.thomasnederman.com with HTTP; Sat, 16 Sep 2006 11:07:38 +0000
    X-IlohaMail-Blah: thomas @ aconcagua.se
    X-IlohaMail-Method: mail() [mem]
    X-IlohaMail-Dummy: moo
    X-Mailer: IlohaMail/0.8.14 (On: mail.thomasnederman.com)
    Message-ID: <6qAmbGmK.1158404858.2632130.thomas @ aconcagua.se>
    From: <thomas @ redirect.tne-url.com>
    Bounce-To: <thomas @ aconcagua.se>
    Errors-To: <thomas @ redirect.tne-url.com>
    MIME-Version: 1.0
    Content-Type: text/plain; charset=ISO-8859-1
    Content-Transfer-Encoding: quoted-printable
    X-Virus-Scanned: amavisd-new at thomasnederman.com
    X-Spam-Status: No, hits=3.2 tagged_above=2 required=6.31 tests=AWL, BAYES_00,
    NO_REAL_NAME, RCVD_IN_DSBL, RCVD_IN_SORBS_DUL
    X-Spam-Level: ***

    I sent this from thomas @ aconcagua.se, but somehow the from in the e-mail got changed into thomas @ redirect.tne-url.com

    If we look at DNS configuration for aconcagua.se

    host -t MX aconcagua.se
    aconcagua.se is an alias for redirect.tne-url.com.
    redirect.tne-url.com mail is handled by 5 mail.aconcagua.se.

    if i look in my configuration on dns, it say

    aconcagua.se CNAME redirect.tne-url.com.
    aconcagua.se MX 5 mail.aconcagua.se.
    mail A 195.70.17.194

    Why does it not say
    aconcagua.se mail is handled by 5 mail.aconcagua.se

    Why does it use the information for redirect.tne-url.com ?

    As well, why does my SMTP rewrite the e-mail on the mails i send. with SMTP you can usualy send e-mail from any e-mail you like ?

    Does anyone have any input and can help ? I could solve it by changing to A record instead of CNAME, but if i can i would rather find a solution where i can keep the CNAME..

    Thanks for your inputs !
     
    ThomasNederman, Sep 16, 2006 IP
  2. MrX

    MrX Well-Known Member

    Messages:
    1,563
    Likes Received:
    77
    Best Answers:
    0
    Trophy Points:
    140
    #2
    A better solution would be to stick an .htaccess in your root public_html folder, containing the following:

    RewriteEngine On
    RewriteCond %{HTTP_HOST} !^www\.site\.com
    RewriteRule (.*) http://www.site.com/$1 [R=301,L]
     
    MrX, Sep 16, 2006 IP