postfix/email problems...will not send emails out

Discussion in 'Server Operation' started by plathw, Nov 20, 2007.

  1. plathw

    plathw New Member

    I am running X-Cart (shopping cart software) on linux/ubuntu and am having problems with emails being sent out. I believe that some emails are being sent out, but it seems to be having problems sending emails to my domains.

    My actual mail server that I use for the company is hosted on another server, but the domain (______.coker.com) is hosted on the linux box. When my shopping cart program tries to send emails to [email protected] it seems to be getting errors. Hope this makes sence.

    Error Log:
    Code:
    20 09:11:09 cokerlinux1 postfix/cleanup[14706]: 6CAE0298147: message-id=<20071120141109.6CAE0298147@cokerlinux1>
    Nov 20 09:11:09 cokerlinux1 postfix/qmgr[1176]: 6CAE0298147: from=<[email protected]>, size=6078, nrcpt=1 (queue active)
    Nov 20 09:11:09 cokerlinux1 postfix/smtp[14707]: connect to mailin-02.mx.aol.com[64.12.137.168]: server dropped connection without sending the initial SMTP greeting (port 25)
    Nov 20 09:11:10 cokerlinux1 postfix/smtp[14707]: 6CAE0298147: to=<[email protected]>, relay=mailin-02.mx.aol.com[64.12.137.89], delay=1, status=sent (250 OK)
    Nov 20 09:11:10 cokerlinux1 postfix/qmgr[1176]: 6CAE0298147: removed
    Nov 20 09:12:11 cokerlinux1 postfix/pickup[13166]: D072C298147: uid=33 from=<[email protected]>
    Nov 20 09:12:11 cokerlinux1 postfix/cleanup[14706]: D072C298147: message-id=<20071120141211.D072C298147@cokerlinux1>
    Nov 20 09:12:11 cokerlinux1 postfix/qmgr[1176]: D072C298147: from=<[email protected]>, size=20935, nrcpt=1 (queue active)
    Nov 20 09:12:12 cokerlinux1 postfix/pickup[13166]: 0670829814A: uid=33 from=<[email protected]>
    Nov 20 09:12:12 cokerlinux1 postfix/cleanup[14706]: 0670829814A: message-id=<20071120141212.0670829814A@cokerlinux1>
    Nov 20 09:12:12 cokerlinux1 postfix/qmgr[1176]: 0670829814A: from=<[email protected]>, size=21601, nrcpt=1 (queue active)
    Nov 20 09:12:12 cokerlinux1 postfix/qmgr[1176]: 0670829814A: to=<[email protected]>, relay=none, delay=1, status=deferred (delivery temporarily suspended: connect to coker.com[66.18.46.195]: Connection refused)
    Nov 20 09:12:12 cokerlinux1 postfix/pickup[13166]: 311EE29814C: uid=33 from=<[email protected]>
    Nov 20 09:12:12 cokerlinux1 postfix/cleanup[14706]: 311EE29814C: message-id=<20071120141212.311EE29814C@cokerlinux1>
    Nov 20 09:12:12 cokerlinux1 postfix/qmgr[1176]: 311EE29814C: from=<[email protected]>, size=20860, nrcpt=1 (queue active)
    Nov 20 09:12:12 cokerlinux1 postfix/qmgr[1176]: 311EE29814C: to=<[email protected]>, relay=none, delay=0, status=deferred (delivery temporarily suspended: connect to coker.com[66.18.46.195]: Connection refused)
    Nov 20 09:12:13 cokerlinux1 postfix/smtp[14707]: D072C298147: to=<[email protected]>, relay=mailin-01.mx.aol.com[205.188.156.248], delay=2, status=sent (250 OK)
    Nov 20 09:12:13 cokerlinux1 postfix/qmgr[1176]: D072C298147: removed
    Nov 20 09:14:05 cokerlinux1 postfix/smtp[14634]: connect to mail.twinpharm.cn[82.208.60.203]: read timeout (port 25)
    Nov 20 09:14:05 cokerlinux1 postfix/smtp[14634]: 7550729817B: to=<[email protected]>, relay=none, delay=49989, status=deferred (connect to mail.twinpharm.cn[82.208.60.203]: read timeout)
    Nov 20 09:14:10 cokerlinux1 postfix/smtp[14632]: connect to mail.twinpharm.cn[82.208.60.203]: read timeout (port 25)
    Nov 20 09:14:10 cokerlinux1 postfix/smtp[14632]: EAAF729816E: to=<[email protected]>, relay=none, delay=50002, status=deferred (connect to mail.twinpharm.cn[82.208.60.203]: read timeout)
    
     
  2. plathw

    plathw New Member

    etc/postfix/main.cf (if needed):
    Code:
    # See /usr/share/postfix/main.cf.dist for a commented, more complete version
    
    
    # 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.
    
    myhostname = cokerlinux1
    alias_maps = hash:/etc/aliases
    alias_database = hash:/etc/aliases
    #mydestination = cokerlinux1, localhost.localdomain, , localhost
    relayhost = 
    mynetworks = subnet
    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
    
     
  3. plathw

    plathw New Member

    output of netstat -tap

    Code:
    Active Internet connections (servers and established)
    Proto Recv-Q Send-Q Local Address           Foreign Address         State                                                                                    PID/Program name
    tcp        0      0 *:mysql                 *:*                     LISTEN     3                                                                             883/mysqld
    tcp        0      0 *:81                    *:*                     LISTEN     4                                                                             226/ispconfig_http
    tcp        0      0 *:ftp                   *:*                     LISTEN     4                                                                             481/proftpd: (acce
    tcp        0      0 virtual-ip2-coke:domain *:*                     LISTEN     4                                                                             465/named
    tcp        0      0 virtual-ip3-coke:domain *:*                     LISTEN     4                                                                             465/named
    tcp        0      0 virtual-ip1-coke:domain *:*                     LISTEN     4                                                                             465/named
    tcp        0      0 cokerlinux1:domain      *:*                     LISTEN     4                                                                             465/named
    tcp        0      0 localhost.locald:domain *:*                     LISTEN     4                                                                             465/named
    tcp        0      0 *:smtp                  *:*                     LISTEN     1                                                                             173/master
    tcp        0      0 localhost.localdoma:953 *:*                     LISTEN     4                                                                             465/named
    tcp        0      0 virtual-ip2-coker:40674 network.upl.cz:smtp     ESTABLISHED1                                                                             9262/smtp
    tcp6       0      0 *:imaps                 *:*                     LISTEN     3                                                                             757/couriertcpd
    tcp6       0      0 *:pop3s                 *:*                     LISTEN     3                                                                             792/couriertcpd
    tcp6       0      0 *:pop3                  *:*                     LISTEN     3                                                                             772/couriertcpd
    tcp6       0      0 *:imap2                 *:*                     LISTEN     3                                                                             737/couriertcpd
    tcp6       0      0 *:www                   *:*                     LISTEN     1                                                                             8233/apache2
    tcp6       0      0 *:ssh                   *:*                     LISTEN     4                                                                             055/sshd
    tcp6       0      0 *:smtp                  *:*                     LISTEN     1                                                                             173/master
    tcp6       0      0 ip6-localhost:953       *:*                     LISTEN     4                                                                             465/named
    tcp6       0      0 *:https                 *:*                     LISTEN     1                                                                             8233/apache2
    tcp6       0      0 cokerlinux1:www         adsl-76-228-197-21:2556 TIME_WAIT  -                                                                             
    tcp6       0      0 cokerlinux1:www         ec2-67-202-28-54.:34120 TIME_WAIT  -                                                                             
    tcp6       0      0 cokerlinux1:www         ec2-67-202-28-54.:33769 TIME_WAIT  -                                                                             
    tcp6       0      0 cokerlinux1:www         server.myviphosti:28554 TIME_WAIT  -                                                                             
    tcp6       0      0 cokerlinux1:www         server.myviphosti:28522 TIME_WAIT  -                                                                             
    tcp6       0      0 cokerlinux1:www         adsl-76-228-197-21:2557 TIME_WAIT  -                                                                             
    tcp6       0      0 cokerlinux1:www         adsl-76-228-197-21:2558 TIME_WAIT  -                                                                             
    tcp6       0      0 virtual-ip3-cokerli:www adsl-67-116-253-11:4566 TIME_WAIT  -                                                                             
    tcp6       0      0 cokerlinux1:ssh         it218.coker.net:2442    ESTABLISHED1                                                                             4529/sshd: root@no
    tcp6       0      0 cokerlinux1:www         adsl-76-228-197-21:2559 TIME_WAIT  -                                                                             
    tcp6       0      0 virtual-ip3-cokerli:www adsl-67-116-253-11:4567 TIME_WAIT  -                                                                             
    tcp6       0    148 cokerlinux1:ssh         it218.coker.net:fax     ESTABLISHED1                                                                             9358/0
    tcp6       0      0 cokerlinux1:www         adsl-76-228-197-21:2552 TIME_WAIT  -                                                                             
    tcp6       0      0 cokerlinux1:www         c-68-83-11-151.hs:54978 TIME_WAIT  -                                                                             
    tcp6       0      0 cokerlinux1:www         ::ffff:64.22.107.:54282 TIME_WAIT  -                                                                             
    tcp6       0      0 cokerlinux1:www         ec2-67-202-28-54.:33293 TIME_WAIT  -                                                                             
    tcp6       0      0 cokerlinux1:www         adsl-76-228-197-21:2553 TIME_WAIT  -                                                                             
    tcp6       0      0 cokerlinux1:www         adsl-76-228-197-21:2554 TIME_WAIT  -                                                                             
    tcp6       0      0 virtual-ip3-cokerli:www adsl-67-116-253-11:4562 TIME_WAIT  -                                                                             
    tcp6       0      0 cokerlinux1:www         ec2-67-202-28-54.:33423 TIME_WAIT  -                                                                             
    
     
  4. plathw

    plathw New Member

    netstat -tap cont

    Code:
    tcp6       0      0 cokerlinux1:www         server.myviphosti:28524 TIME_WAIT  -                                                                             
    tcp6       0      0 cokerlinux1:www         adsl-76-228-197-21:2555 TIME_WAIT  -                                                                             
    tcp6       0      0 cokerlinux1:www         ::ffff:64.22.107.:54023 TIME_WAIT  -                                                                             
    tcp6       0      0 cokerlinux1:ssh         it218.coker.net:3009    ESTABLISHED1                                                                             6356/sshd: root@no
    tcp6       0      0 cokerlinux1:www         adsl-76-228-197-21:2548 TIME_WAIT  -                                                                             
    tcp6       0      0 virtual-ip3-cokerli:www adsl-67-116-253-11:4572 TIME_WAIT  -                                                                             
    tcp6       0      0 cokerlinux1:www         ::ffff:64.22.107.:54374 TIME_WAIT  -                                                                             
    tcp6       0      0 cokerlinux1:www         adsl-76-228-197-21:2549 TIME_WAIT  -                                                                             
    tcp6       0      0 virtual-ip3-cokerli:www adsl-67-116-253-11:4573 TIME_WAIT  -                                                                             
    tcp6       0      0 cokerlinux1:www         ::ffff:64.22.107.:54373 TIME_WAIT  -                                                                             
    tcp6       0      0 cokerlinux1:www         adsl-76-228-197-21:2550 TIME_WAIT  -                                                                             
    tcp6       0      0 virtual-ip3-cokerli:www adsl-67-116-253-11:4574 TIME_WAIT  -                                                                             
    tcp6       0      0 cokerlinux1:www         adsl-76-228-197-21:2551 TIME_WAIT  -                                                                             
    tcp6       0      0 virtual-ip3-cokerli:www adsl-67-116-253-11:4575 TIME_WAIT  -                                                                             
    tcp6       0      0 virtual-ip3-cokerli:www adsl-67-116-253-11:4568 TIME_WAIT  -                                                                             
    tcp6       0      0 cokerlinux1:www         server.myviphosti:28550 TIME_WAIT  -                                                                             
    tcp6       0      0 virtual-ip3-cokerli:www adsl-67-116-253-118:iax TIME_WAIT  -                                                                             
    tcp6       0      0 cokerlinux1:www         ::ffff:64.22.107.:53954 TIME_WAIT  -                                                                             
    tcp6       0      0 cokerlinux1:www         ::ffff:64.22.107.:54049 TIME_WAIT  -                                                                             
    tcp6       0      0 cokerlinux1:www         ::ffff:64.22.107.:54273 TIME_WAIT  -                                                                             
    tcp6       0      0 cokerlinux1:www         2.ae.344a.static.:59294 TIME_WAIT  -                                                                             
    tcp6       0      0 cokerlinux1:ssh         it218.coker.net:2823    ESTABLISHED1                                                                             5726/sshd: root@no
    tcp6       0      0 cokerlinux1:www         ec2-67-202-28-54.:33862 TIME_WAIT  -                                                                             
    tcp6       0      0 cokerlinux1:www         2.ae.344a.static.:59295 TIME_WAIT  -                                                                             
    tcp6       0      0 cokerlinux1:www         ::ffff:64.22.107.:54368 TIME_WAIT  -                                                                             
    tcp6       0      0 virtual-ip3-cokerli:www adsl-67-116-253-11:4571 TIME_WAIT  -                                                                             
    tcp6       0      0 cokerlinux1:www         main.anicom.org:39750   TIME_WAIT  -                                                                             
    tcp6       0      0 cokerlinux1:www         ::ffff:64.22.107.:54367 TIME_WAIT  -                                                                             
    tcp6       0      0 cokerlinux1:www         ec2-67-202-28-54.:34041 TIME_WAIT  -                                                                             
    tcp6       0      0 cokerlinux1:www         ::ffff:64.22.107.:54109 TIME_WAIT  -                                                                             
    tcp6       0      0 cokerlinux1:www         main.anicom.org:39653   TIME_WAIT  -                                                                             
    tcp6       0      0 virtual-ip3-cokerli:www adsl-67-116-253-11:4576 TIME_WAIT  -                                                                             
    tcp6       0      0 virtual-ip3-cokerli:www adsl-67-116-253-11:4577 TIME_WAIT  -                                                                             
    tcp6       0      0 cokerlinux1:www         ::ffff:64.22.107.:53945 TIME_WAIT  -                                                                             
    tcp6       0      0 cokerlinux1:www         ::ffff:64.22.107.:54296 TIME_WAIT  -                                                                             
    tcp6       0      0 virtual-ip3-cokerli:www adsl-67-116-253-11:4547 TIME_WAIT  -                                                                             
    tcp6       0      0 virtual-ip3-cokerli:www adsl-67-116-253-11:4556 TIME_WAIT  -                                                                             
    tcp6       0      0 cokerlinux1:www         main.anicom.org:39599   TIME_WAIT  -                                                                             
    tcp6       0      0 cokerlinux1:www         ec2-67-202-28-54.:34227 TIME_WAIT  -                                                                             
    tcp6       0      0 cokerlinux1:www         ec2-67-202-28-54.:33523 TIME_WAIT  -                                                                             
    tcp6       0      0 cokerlinux1:www         ::ffff:64.22.107.:54196 TIME_WAIT  -                                                                             
    tcp6       0      0 cokerlinux1:www         adsl-76-228-197-21:2560 TIME_WAIT  -                                                                             
    tcp6       0      0 virtual-ip3-cokerli:www adsl-67-116-253-11:4552 TIME_WAIT  -                                                                             
    tcp6       0      0 cokerlinux1:www         adsl-76-228-197-21:2561 TIME_WAIT  -                                                                             
    tcp6       0      0 virtual-ip3-cokerli:www adsl-67-116-253-11:4553 TIME_WAIT  -                                                                             
    tcp6       0      0 cokerlinux1:www         main.anicom.org:39752   TIME_WAIT  -                                                                             
    tcp6       0      0 cokerlinux1:www         adsl-76-228-197-21:2562 TIME_WAIT  -                                                                             
    tcp6       0      0 cokerlinux1:www         ::ffff:64.22.107.:54289 TIME_WAIT  -                                                                             
    tcp6       0      0 cokerlinux1:www         adsl-76-228-197-21:2563 TIME_WAIT  -  
     
  5. plathw

    plathw New Member

    Anyone? I just found out this is being sent to every customer. Every order placed sends an order notification to [email protected], with the "from" email address being the customer's. Since email can not be delivered to [email protected] the customer is being sent this:

    Code:
    This is the Postfix program at host cokerlinux1.
    
    I'm sorry to have to inform you that your message could not
    be delivered to one or more recipients. It's attached below.
    
    For further assistance, please send mail to <postmaster>
    
    If you do so, please include this problem report. You can
    delete your own text from the attached returned message.
    
       The Postfix program
    
    <[email protected]>: delivery temporarily suspended: connect to
        coker.com[66.18.46.195]: Connection refused
    
    --------------------------------------------------------------------------------
    Reporting-MTA: dns; cokerlinux1
    X-Postfix-Queue-ID: 0586B2986A0
    X-Postfix-Sender: rfc822; [email protected]
    Arrival-Date: Mon, 12 Nov 2007 21:48:01 -0500 (EST)
    
    Final-Recipient: rfc822; [email protected]
    Action: failed
    Status: 4.0.0
    Diagnostic-Code: X-Postfix; delivery temporarily suspended: connect to
        coker.com[66.18.46.195]: Connection refused
    
    ------ End of Forwarded Message
     
  6. falko

    falko Super Moderator Howtoforge Staff

    Is 66.18.46.195 your server's IP address? Do you have a firewall that blocks port 25? What's the output of
    Code:
    iptables -L
    ?
     
  7. plathw

    plathw New Member

    Code:
    Chain INPUT (policy ACCEPT)
    target     prot opt source               destination
    
    Chain FORWARD (policy ACCEPT)
    target     prot opt source               destination
    
    Chain OUTPUT (policy ACCEPT)
    target     prot opt source               destination
    
    Okay, there is the output for you, but I think I have narrowed down the problem some. I double checked the 66.18.46.195...this is not the server's IP address, but I thought this was our mail server IP. It is actually another web hosting box we have here for coker.com. The actual IP for the mail server is 192.168.0.201.

    The MX record is set up correctly with our domain host, and we get mail just fine. I think that it has something to do with either subdomains of coker.com being hosted by the linux box postfix is running on, or it is because the linux box is within our local network along with several other servers.

    Both of those may not even be close, but I'm not sure what else it could be!

    So, to sum it up, when post fix sends mail to outside email hosts (not coker.com) it sends just fine and finds the correct MX record. When it tries to send to coker.com it is sending it to the web host NOT the mail host as set up in with our domain host.

    EDIT: Also, after going through the forums again, just wanted to let you know that each domain has been set to external mailserver, and the co-domain "coker.com" has been set to external mailserver as well.
     
    Last edited: Nov 21, 2007
  8. falko

    falko Super Moderator Howtoforge Staff

    And what's the mail server's public IP address (this is the public IP address of your router)? Did you forward port 25 from your router to your server?
     
  9. plathw

    plathw New Member

    66.18.46.196 is the public IP. Yes, it is forwarding properly. The mail server is getting mail just fine from other sources.
     
  10. chipsafts

    chipsafts New Member

    local DNS mis-configuration ?
     
  11. plathw

    plathw New Member

    I have not set up DNS through BIND on this server...is that needed? My domains names are set up with network solutions.
     
  12. falko

    falko Super Moderator Howtoforge Staff

    coker.com is resolving to 66.18.46.195, not 66.18.46.196. I think this is the problem.
     
  13. plathw

    plathw New Member

    Sorry, when it tries to send the mail out, it tries to send it to coker.com dns record which is 66.18.46.195. For some reason it is not seeing the MX record which is 66.18.46.196 (mail.coker.com).

    We do get email from other sources just fine, but for some reason our box isn't looking at the MX record but instead trying to communicate with 66.18.46.195 which is not a mail server and therefor giving the connection error.

    I'm really at wits end here...I've searched these forums and the internet for days now and can not find this problem any where.
     
  14. falko

    falko Super Moderator Howtoforge Staff

    Code:
    mh1:~# dig mx coker.com
    
    ; <<>> DiG 9.2.1 <<>> mx coker.com
    ;; global options:  printcmd
    ;; Got answer:
    ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 13300
    ;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 2
    
    ;; QUESTION SECTION:
    ;coker.com.                     IN      MX
    
    ;; ANSWER SECTION:
    coker.com.              7200    IN      MX      20 MAIL.coker.com.
    coker.com.              7200    IN      MX      [B][COLOR="Red"]10 FILTER.coker.com[/COLOR][/B].
    
    ;; ADDITIONAL SECTION:
    FILTER.coker.com.       7200    IN      A       66.18.46.204
    MAIL.coker.com.         7200    IN      A       66.18.46.196
    
    ;; Query time: 271 msec
    ;; SERVER: 213.191.92.84#53(213.191.92.84)
    ;; WHEN: Wed Nov 28 15:51:59 2007
    ;; MSG SIZE  rcvd: 103
    
    mh1:~#
    Mails will be sent to FILTER.coker.com because it has the highest priority.
     

Share This Page