Small error with mail script on my website

Discussion in 'Installation/Configuration' started by jorizzzz, Jun 9, 2008.

  1. jorizzzz

    jorizzzz New Member

    I've got a strange problem with a mail script on my website. This script is a contact form that emails me with questions from users. But since i've began using an external mail server, the emails aren't delivered any more. I've done the following things:

    - Deleted my old mail accounts on the server
    - Deleted the mx records
    - set the mailserver (domain -> options -> mailserver) to external

    If i'm checking my log files while sending an e-mail, it says that it deliveres it to [email protected] instead of [email protected] what i've entered in the mail form..

    YH-Linux01.mydomain.nl is the hostname of my server...

    Here is a piece of code of the mail form:

    Code:
    mail("$ContactWebsiteNaam <$ContactEmail>","$ContactOnderwerp","$Body","$Hoofd");
    
    Where $ContactEmail is [email protected]

    How can i correct these problems? This is the message from my mail.log:

    Code:
    Jun  9 18:06:37 YH-Linux01 postfix/local[29337]: AC67F1D005B: to=<[email protected]>, relay=local, delay=0.07, delays=0.03/0/0/0.04, dsn=2.0.0, status=sent (delivered to command: procmail -a "$EXTENSION")
    
    As you can see, it is not mailed to my domain but to the hostname of my server...
     
  2. falko

    falko Super Moderator Howtoforge Staff

    What's in /etc/postfix/main.cf and /etc/hosts? What's the output of
    Code:
    hostname -f
    ?
     
  3. jorizzzz

    jorizzzz New Member

    Main.cf:
    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 (Ubuntu)
    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.
    
    message_size_limit = 20971520
    myhostname = YH-Linux01.mydomain.nl
    alias_maps = hash:/etc/aliases
    alias_database = hash:/etc/aliases
    myorigin = /etc/mailname
    #mydestination = YH-Linux01.mydomain.nl, localhost.mydomain.nl, localhost
    relayhost =
    mynetworks = 127.0.0.0/8
    mailbox_command = procmail -a "$EXTENSION"
    mailbox_size_limit = 0
    message_size_limit = 25000000
    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
    
    smtpd_helo_required = yes
    disable_vrfy_command = yes
    strict_rfc821_envelopes = yes
    
    maps_rbl_domains =
                multi.uribl.com,
                dsn.rfc-ignorant.org,
                dul.dnsbl.sorbs.net,
                list.dsbl.org,
                sbl-xbl.spamhaus.org,
                bl.spamcop.net,
                dnsbl.sorbs.net,
                cbl.abuseat.org,
                ix.dnsbl.manitu.net,
                combined.rbl.msrbl.net,
                rabl.nuclearelephant.com
    
    smtpd_recipient_restrictions =
                permit_sasl_authenticated,
                permit_mynetworks,
                reject_invalid_hostname,
                reject_non_fqdn_hostname,
                reject_non_fqdn_sender,
                reject_unknown_sender_domain,
                reject_unknown_recipient_domain,
                reject_maps_rbl,
                check_relay_domains
    
    /etc/hosts:
    Code:
    127.0.0.1       localhost.localdomain           localhost
    xxx.xxx.xxx.xxx  YH-Linux01.mydomain.nl      YH-Linux01
    
    I've hidden the actual IP address

    Output of hostname -f:
    Code:
    YH-Linux01.mydomain.nl
    
     
  4. falko

    falko Super Moderator Howtoforge Staff

    What's in /etc/postfix/local-host-names, /etc/mailname, and /etc/aliases?
     
  5. jorizzzz

    jorizzzz New Member

    Local-host-names:
    Code:
    localhost
    YH-Linux01.mydomain.nl
    localhost.YH-Linux01.mydomain.nl
    localhost.mydomain.nl
    localhost.localdomain
    mydomain.nl
    
    and ofcourse the domains of my clients

    /etc/mailname:
    Code:
    YH-Linux01.mydomain.nl
    
    /etc/aliases:
    Code:
    # Added by installer for initial user
    root:   fred
    clamav: root
    
     
  6. falko

    falko Super Moderator Howtoforge Staff

    The problem is that mydomain.nl is listed in /etc/postfix/local-host-names. Did you set the Co-Domain mydomain.nl to external mailserver as well in ISPConfig (go to Co-Domains, select mydomain.nl, and then go to the Options tab)?
     
  7. jorizzzz

    jorizzzz New Member

    Yes it is set to external mailserver. The ispconfig messages aren't coming in as well... These are sent to the same e-mail address.

    What is the best option for this? Remove the entry in local-host-names?
     
  8. falko

    falko Super Moderator Howtoforge Staff

    On the Co-Domains tab, or only for the main domain of the site?

    No, because ISPConfig will overwrite your changes...
     

Share This Page