Mail Header and Postfix

Discussion in 'Server Operation' started by kkonline, Dec 26, 2008.

  1. kkonline

    kkonline New Member

    Hi,
    Whenever I send mail it has the following header which takes the mail to spam
    Code:
     
     Delivered-To: [email protected]
    Received: by 10.141.129.17 with SMTP id g17cs376644rvn;
            Fri, 26 Dec 2008 11:05:47 -0800 (PST)
    Received: by 10.210.142.10 with SMTP id p10mr177422ebd.95.1230318345065;
            Fri, 26 Dec 2008 11:05:45 -0800 (PST)
    Return-Path: <[email protected]>
    Received: from mail.mysite.org (mysite.org [203.54.237.227])
            by mx.google.com with ESMTP id p10si16333536gvf.20.2008.12.26.11.05.43;
            Fri, 26 Dec 2008 11:05:44 -0800 (PST)
    Received-SPF: neutral (google.com: 203.54.237.227 is neither permitted nor denied by best guess record for domain of [email protected]) client-ip=203.54.237.227;
    Authentication-Results: mx.google.com; spf=neutral (google.com: 203.54.237.227 is neither permitted nor denied by best guess record for domain of [email protected]) [email protected]
    Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
    	by mail.mysite.org (Postfix) with SMTP id 66C3B4D0100
    	for <[email protected]>; Fri, 26 Dec 2008 18:52:59 +0000 (UTC)
    To: [email protected]
    From: [email protected]
    Subject: Hey my first email
    Message-Id: <[email protected]>
    Date: Fri, 26 Dec 2008 18:52:59 +0000 (UTC)
    
    This is my first email on debian postfix after installing configuring it.
    It was easy. See you
    Now I want Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) to be replaced by mysite.org and then check if mail reaches the inbox.

    I have postfix running on debian etch. How do I do the required changes
    Code:
    telnet mysite.org 25
    Trying 203.54.237.227...
    Connected to mysite.org.
    Escape character is '^]'.
    220 mail.mysite.org ESMTP Postfix (Debian/GNU)
    mail from:<[email protected]>
    250 2.1.0 Ok
    rcpt to:<[email protected]>
    data
    To: [email protected]
    From: [email protected]
    Subject: Hey my first email
    This is my first email on debian postfix after installing configuring it.
    It was easy. See you
    554 5.7.1 <[email protected]>: Relay access denied
    554 5.5.1 Error: no valid recipients
    221 2.7.0 Error: I can break rules, too. Goodbye.
    Connection closed by foreign host.
    but
    debian:~# telnet localhost 25 works fine (send mail atleast to spam!!!)
     
  2. falko

    falko Super Moderator Howtoforge Staff

    What's in /etc/postfix/main.cf?

    How did you set up your email account?
     
  3. kkonline

    kkonline New Member

    Code:
    # Debian specific:  Specifying a file name will cause the first
    # line of that file to be used as the name.  The Debian default
    # is /etc/mailname.
    #myorigin = /etc/mailname
    
    smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
    biff = no
    
    # appending .domain is the MUA's job.
    append_dot_mydomain = no
    
    # Uncomment the next line to generate "delayed mail" warnings
    #delay_warning_time = 4h
    
    # TLS parameters
    smtpd_tls_cert_file = /etc/postfix/ssl/smtpd.crt
    smtpd_tls_key_file = /etc/postfix/ssl/smtpd.key
    smtpd_use_tls = yes
    smtpd_tls_session_cache_database = btree:${queue_directory}/smtpd_scache
    smtp_tls_session_cache_database = btree:${queue_directory}/smtp_scache
    
    # See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
    # information on enabling SSL in the smtp client.
    
    myhostname = mail.mysite.org
    alias_maps = hash:/etc/aliases
    alias_database = hash:/etc/aliases
    myorigin = /etc/mailname
    #mydestination = mail.mysite.org, debian.4.x86_64, localhost.4.x86_64, localhost
    relayhost = 
    mynetworks = 127.0.0.0/8
    mailbox_command = procmail -a "$EXTENSION"
    mailbox_size_limit = 0
    recipient_delimiter = +
    inet_interfaces = all
    inet_protocols = all
    smtpd_sasl_local_domain = 
    smtpd_sasl_auth_enable = yes
    smtpd_sasl_security_options = noanonymous
    broken_sasl_auth_clients = yes
    smtpd_recipient_restrictions = permit_sasl_authenticated,permit_mynetworks,reject_unauth_destination
    smtpd_tls_auth_only = no
    smtp_use_tls = yes
    smtp_tls_note_starttls_offer = yes
    smtpd_tls_CAfile = /etc/postfix/ssl/cacert.pem
    smtpd_tls_loglevel = 1
    smtpd_tls_received_header = yes
    smtpd_tls_session_cache_timeout = 3600s
    tls_random_source = dev:/dev/urandom
    
    virtual_maps = hash:/etc/postfix/virtusertable
    
    mydestination = /etc/postfix/local-host-names
    The emails are configured using ispconfig and I use swiftmailer to send the mails
     
  4. falko

    falko Super Moderator Howtoforge Staff

    What's in /etc/mailname?
     
  5. kkonline

    kkonline New Member

    it's mysite.org
     
  6. falko

    falko Super Moderator Howtoforge Staff

    What are the outputs of
    Code:
    hostname
    and
    Code:
    hostname -f
    ?

    What's the output of
    Code:
    postconf -d | grep localhost.localdomain
    ?
     
  7. kkonline

    kkonline New Member

    debian:~# hostname
    Code:
    debian.4.x86_64
    debian:~# hostname -f
    Code:
    mysite.org
    debian:~# postconf -d | grep localhost.localdomain
    debian:~#
     
  8. kkonline

    kkonline New Member

    I just edit /etc/hostname. and now in the email header it shows
    Code:
    Received: from [208.8.237.227] (mysite.org [127.0.0.1])
    	by mail.mysite.org (Postfix) with ESMTP id 48EB44D00FE
    	for <[email protected]>; Mon, 29 Dec 2008 15:07:06 +0000 (UTC)
    
    After changing /etc/hostname localhost.localdomain was replaced by mysite.org but the ip still is 127.0.0.1 which i think should be 208.8.237.227

    my /etc/hosts is
    Code:
    127.0.0.1       mysite.org  localhost.localdomain   localhost debian.4.x86_64
    The /etc/resolve.conf gives

    Code:
    nameserver 127.0.0.1
    search vpsfarm.com
    
    Is this ok?
     
    Last edited: Dec 29, 2008
  9. falko

    falko Super Moderator Howtoforge Staff

    I think it shows 127.0.0.1 because you're sending the email directly from the server using a webmail application. This should be ok.
     

Share This Page